@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
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../../../../../sdk/relationships.ts", "../../../../../../../../sdk/relationship-context.ts", "../../../../../../../../sdk/dependencies.ts"],
4
- "sourcesContent": ["/**\n * @module sdk/relationships\n *\n * Provides the dependency-free relationship ontology and bounded graph-query\n * kernel shared by the SDK, CLI, MCP adapters, extensions, and non-PM apps.\n */\nimport type { Dependency, ItemMetadata } from \"../types/index.js\";\n\n/** Direction exposed by a relationship kind. */\nexport type RelationshipDirection = \"directed\" | \"undirected\";\n/** Cardinality constraint applied independently to outgoing and incoming edges. */\nexport type RelationshipCardinality = \"one\" | \"many\";\n/** Lifecycle policy for a relationship kind. */\nexport type RelationshipLifecycle = \"persistent\" | \"supersedable\" | \"ephemeral\";\n/** Direction in which an ordering edge contributes to execution precedence. */\nexport type RelationshipPrecedence =\n | \"source_before_target\"\n | \"target_before_source\";\n/** Endpoint that represents the structural parent for hierarchy kinds. */\nexport type RelationshipHierarchyDirection = \"source_parent\" | \"target_parent\";\n\n/** Versioned semantic definition for a built-in or application-defined edge kind. */\nexport interface RelationshipKindDefinition {\n /** Canonical, case-insensitive kind identifier. */\n kind: string;\n /** Whether traversing source to target has distinct meaning from the reverse. */\n direction: RelationshipDirection;\n /** Optional canonical kind used when traversing a directed edge in reverse. */\n inverse?: string;\n /** Whether the kind participates in execution-order cycle checks. */\n ordering: boolean;\n /** Execution direction for ordering kinds; defaults to source before target. */\n precedence?: RelationshipPrecedence;\n /** Whether the kind contributes to structural ancestry. */\n hierarchy: boolean;\n /** Endpoint that represents the parent; defaults to source for custom kinds. */\n hierarchyDirection?: RelationshipHierarchyDirection;\n /** Maximum logical outgoing edges of this kind from one node. */\n outgoing: RelationshipCardinality;\n /** Maximum logical incoming edges of this kind to one node. */\n incoming: RelationshipCardinality;\n /** Edge replacement and retention behavior. */\n lifecycle: RelationshipLifecycle;\n /** JSON Schema for optional application-owned payloads. */\n payloadSchema?: Readonly<Record<string, unknown>>;\n /** Legacy spellings normalized to this definition. */\n aliases?: readonly string[];\n /** Compatibility version of this semantic contract. */\n compatibilityVersion: number;\n /** Whether source and target may be the same node. */\n allowSelf: boolean;\n}\n\n/** One normalized relationship edge indexed by the graph kernel. */\nexport interface RelationshipEdge {\n /** Source node identifier. */\n source: string;\n /** Target node identifier. */\n target: string;\n /** Canonical relationship kind. */\n kind: string;\n /** Optional creation timestamp retained from storage. */\n createdAt?: string;\n /** Optional author retained from storage. */\n author?: string;\n /** Optional application-owned edge payload. */\n payload?: Readonly<Record<string, unknown>>;\n}\n\n/** Direction used by adjacency, closure, and path traversal. */\nexport type RelationshipTraversalDirection = \"outgoing\" | \"incoming\" | \"both\";\n\n/** Shared bounded-query controls. */\nexport interface RelationshipQueryOptions {\n /** Edge kinds to traverse after alias normalization. */\n kinds?: readonly string[];\n /** Traversal direction relative to each visited node. */\n direction?: RelationshipTraversalDirection;\n /** Maximum number of returned nodes, excluding the starting node. */\n limit?: number;\n /** Maximum traversal depth. */\n maxDepth?: number;\n /** Abort signal checked throughout traversal. */\n signal?: AbortSignal;\n}\n\n/** Cost and truncation metadata returned by every graph query. */\nexport interface RelationshipQueryMeta {\n /** Number of nodes removed from the traversal frontier. */\n visitedNodes: number;\n /** Number of candidate edges inspected. */\n inspectedEdges: number;\n /** Whether a configured bound stopped traversal. */\n truncated: boolean;\n /** Deterministic continuation cursor for the final returned node. */\n nextCursor?: string;\n}\n\n/** Generic bounded graph query result. */\nexport interface RelationshipQueryResult<T> {\n /** Deterministically ordered query value. */\n value: T;\n /** Explicit query work and truncation metadata. */\n meta: RelationshipQueryMeta;\n}\n\n/** Induced subgraph returned by bounded traversal. */\nexport interface RelationshipSubgraph {\n /** Deterministically ordered node identifiers. */\n nodes: string[];\n /** Deterministically ordered edges whose endpoints are both present. */\n edges: RelationshipEdge[];\n}\n\nconst BUILTIN_RELATIONSHIP_KINDS: readonly RelationshipKindDefinition[] = [\n {\n kind: \"blocked_by\",\n direction: \"directed\",\n inverse: \"blocks\",\n ordering: true,\n precedence: \"target_before_source\",\n hierarchy: false,\n outgoing: \"many\",\n incoming: \"many\",\n lifecycle: \"persistent\",\n aliases: [\"depends_on\"],\n compatibilityVersion: 1,\n allowSelf: false,\n },\n {\n kind: \"blocks\",\n direction: \"directed\",\n inverse: \"blocked_by\",\n ordering: true,\n precedence: \"source_before_target\",\n hierarchy: false,\n outgoing: \"many\",\n incoming: \"many\",\n lifecycle: \"persistent\",\n compatibilityVersion: 1,\n allowSelf: false,\n },\n {\n kind: \"parent\",\n direction: \"directed\",\n inverse: \"child\",\n ordering: false,\n hierarchy: true,\n hierarchyDirection: \"target_parent\",\n outgoing: \"one\",\n incoming: \"many\",\n lifecycle: \"supersedable\",\n aliases: [\"child_of\", \"epic\"],\n compatibilityVersion: 1,\n allowSelf: false,\n },\n {\n kind: \"child\",\n direction: \"directed\",\n inverse: \"parent\",\n ordering: false,\n hierarchy: true,\n hierarchyDirection: \"source_parent\",\n outgoing: \"many\",\n incoming: \"one\",\n lifecycle: \"supersedable\",\n aliases: [\"parent_child\", \"task\"],\n compatibilityVersion: 1,\n allowSelf: false,\n },\n {\n kind: \"related\",\n direction: \"undirected\",\n ordering: false,\n hierarchy: false,\n outgoing: \"many\",\n incoming: \"many\",\n lifecycle: \"persistent\",\n aliases: [\"related_to\"],\n compatibilityVersion: 1,\n allowSelf: false,\n },\n {\n kind: \"discovered_from\",\n direction: \"directed\",\n ordering: false,\n hierarchy: false,\n outgoing: \"many\",\n incoming: \"many\",\n lifecycle: \"persistent\",\n compatibilityVersion: 1,\n allowSelf: false,\n },\n {\n kind: \"incident_from\",\n direction: \"directed\",\n ordering: false,\n hierarchy: false,\n outgoing: \"many\",\n incoming: \"many\",\n lifecycle: \"persistent\",\n compatibilityVersion: 1,\n allowSelf: false,\n },\n {\n kind: \"supersedes\",\n direction: \"directed\",\n ordering: false,\n hierarchy: false,\n outgoing: \"many\",\n incoming: \"many\",\n lifecycle: \"supersedable\",\n compatibilityVersion: 1,\n allowSelf: false,\n },\n] as const;\n\nfunction normalizeKind(kind: string): string {\n return kind.trim().toLowerCase().replaceAll(\"-\", \"_\");\n}\n\nfunction normalizeInverseKind(inverse: string | undefined): string | undefined {\n if (inverse === undefined) return undefined;\n const normalized = normalizeKind(inverse);\n if (!/^[a-z][a-z0-9_]*$/.test(normalized))\n throw new TypeError(`Invalid inverse relationship kind: ${inverse}`);\n return normalized;\n}\n\nfunction freezeValue(value: unknown, visited = new Set<object>()): unknown {\n if (value === null || typeof value !== \"object\") return value;\n if (visited.has(value)) return value;\n visited.add(value);\n if (Array.isArray(value)) {\n for (const entry of value) freezeValue(entry, visited);\n return Object.freeze(value);\n }\n for (const entry of Object.values(value)) freezeValue(entry, visited);\n return Object.freeze(value);\n}\n\nfunction assertRelationshipPrecedence(\n definition: RelationshipKindDefinition,\n kind: string,\n): void {\n if (\n definition.precedence !== undefined &&\n definition.precedence !== \"source_before_target\" &&\n definition.precedence !== \"target_before_source\"\n )\n throw new TypeError(`Invalid relationship precedence for ${kind}`);\n if (!definition.ordering && definition.precedence !== undefined)\n throw new TypeError(\n `Non-ordering relationship kind cannot declare precedence: ${kind}`,\n );\n}\n\nfunction assertRelationshipHierarchyDirection(\n definition: RelationshipKindDefinition,\n kind: string,\n): void {\n if (\n definition.hierarchyDirection !== undefined &&\n definition.hierarchyDirection !== \"source_parent\" &&\n definition.hierarchyDirection !== \"target_parent\"\n )\n throw new TypeError(`Invalid relationship hierarchy direction for ${kind}`);\n if (!definition.hierarchy && definition.hierarchyDirection !== undefined)\n throw new TypeError(\n `Non-hierarchy relationship kind cannot declare hierarchy direction: ${kind}`,\n );\n}\n\n/** Mutable registry with immutable snapshots and collision-safe extension registration. */\nexport class RelationshipKindRegistry {\n readonly #definitions = new Map<string, RelationshipKindDefinition>();\n readonly #aliases = new Map<string, string>();\n\n /** Create a registry initialized with the stable built-in ontology by default. */\n public constructor(\n definitions: readonly RelationshipKindDefinition[] = BUILTIN_RELATIONSHIP_KINDS,\n ) {\n for (const definition of definitions) this.register(definition);\n }\n\n /** Register one definition after validating its identifier, version, and aliases. */\n public register(definition: RelationshipKindDefinition): this {\n const kind = normalizeKind(definition.kind);\n if (!/^[a-z][a-z0-9_]*$/.test(kind))\n throw new TypeError(`Invalid relationship kind: ${definition.kind}`);\n if (\n !Number.isInteger(definition.compatibilityVersion) ||\n definition.compatibilityVersion < 1\n )\n throw new TypeError(`Invalid compatibility version for ${kind}`);\n assertRelationshipPrecedence(definition, kind);\n assertRelationshipHierarchyDirection(definition, kind);\n if (this.#definitions.has(kind) || this.#aliases.has(kind))\n throw new TypeError(`Relationship kind already registered: ${kind}`);\n const inverse = normalizeInverseKind(definition.inverse);\n const aliases = [\n ...new Set((definition.aliases ?? []).map(normalizeKind)),\n ].sort();\n for (const alias of aliases) {\n if (!/^[a-z][a-z0-9_]*$/.test(alias))\n throw new TypeError(`Invalid relationship alias: ${alias}`);\n if (\n alias === kind ||\n this.#definitions.has(alias) ||\n this.#aliases.has(alias)\n )\n throw new TypeError(`Relationship alias already registered: ${alias}`);\n }\n const normalized = Object.freeze({\n ...definition,\n kind,\n inverse,\n aliases: Object.freeze(aliases),\n payloadSchema: definition.payloadSchema\n ? (freezeValue(structuredClone(definition.payloadSchema)) as Readonly<\n Record<string, unknown>\n >)\n : undefined,\n });\n this.#definitions.set(kind, normalized);\n for (const alias of aliases) this.#aliases.set(alias, kind);\n return this;\n }\n\n /** Resolve a canonical kind or compatibility alias. */\n public resolve(kind: unknown): RelationshipKindDefinition | undefined {\n if (typeof kind !== \"string\") return undefined;\n const normalized = normalizeKind(kind);\n return this.#definitions.get(this.#aliases.get(normalized) ?? normalized);\n }\n\n /** Resolve a kind or throw a precise error suitable for command adapters. */\n public require(kind: string): RelationshipKindDefinition {\n const definition = this.resolve(kind);\n if (!definition) throw new TypeError(`Unknown relationship kind: ${kind}`);\n return definition;\n }\n\n /** Return a deterministic immutable registry snapshot. */\n public list(): readonly RelationshipKindDefinition[] {\n return Object.freeze(\n [...this.#definitions.values()].sort((left, right) =>\n left.kind.localeCompare(right.kind),\n ),\n );\n }\n}\n\n/** Create a registry containing the built-in relationship ontology. */\nexport function createRelationshipKindRegistry(): RelationshipKindRegistry {\n return new RelationshipKindRegistry();\n}\n\nconst defaultRegistry = createRelationshipKindRegistry();\n\n/** Report whether a kind participates in execution-order cycle detection. */\nexport function isOrderingRelationshipKind(\n kind: string,\n registry: RelationshipKindRegistry = defaultRegistry,\n): boolean {\n return registry.resolve(kind)?.ordering === true;\n}\n\nfunction compareEdges(left: RelationshipEdge, right: RelationshipEdge): number {\n return (\n left.source.localeCompare(right.source) ||\n left.target.localeCompare(right.target) ||\n left.kind.localeCompare(right.kind)\n );\n}\n\nfunction normalizeRelationshipEdge(\n candidate: RelationshipEdge,\n nodes: ReadonlySet<string>,\n registry: RelationshipKindRegistry,\n): { edge: RelationshipEdge; identity: string } {\n const source =\n typeof candidate.source === \"string\" ? candidate.source.trim() : \"\";\n const target =\n typeof candidate.target === \"string\" ? candidate.target.trim() : \"\";\n const definition = registry.require(candidate.kind);\n if (!nodes.has(source) || !nodes.has(target))\n throw new TypeError(\n `Relationship endpoint not found: ${source} -> ${target}`,\n );\n if (source === target && !definition.allowSelf)\n throw new TypeError(\n `Self relationship is not allowed for ${definition.kind}`,\n );\n const edge = Object.freeze({\n ...candidate,\n source,\n target,\n kind: definition.kind,\n });\n const endpoints =\n definition.direction === \"undirected\"\n ? [source, target].sort().join(\"\\u0000\")\n : `${source}\\u0000${target}`;\n return { edge, identity: `${definition.kind}\\u0000${endpoints}` };\n}\n\nfunction appendIndexedEdge(\n index: Map<string, RelationshipEdge[]>,\n node: string,\n edge: RelationshipEdge,\n): void {\n const indexed = index.get(node);\n if (indexed) indexed.push(edge);\n else index.set(node, [edge]);\n}\n\nfunction normalizeNodeId(value: unknown): string {\n return typeof value === \"string\" ? value.trim() : \"\";\n}\n\nfunction resolveExistingNodeId(\n value: unknown,\n ids: ReadonlySet<string>,\n): string | undefined {\n const id = normalizeNodeId(value);\n return id && ids.has(id) ? id : undefined;\n}\n\nfunction reconstructPath(\n source: string,\n target: string,\n parents: ReadonlyMap<string, string>,\n): string[] {\n const path = [target];\n let cursor = target;\n while (cursor !== source) {\n cursor = parents.get(cursor)!;\n path.push(cursor);\n }\n return path.reverse();\n}\n\n/** Build an immutable, deterministic in-memory relationship index. */\nexport class RelationshipGraph {\n readonly #registry: RelationshipKindRegistry;\n readonly #nodes: Set<string>;\n readonly #nodeSnapshot: readonly string[];\n readonly #edges: readonly RelationshipEdge[];\n readonly #outgoing = new Map<string, RelationshipEdge[]>();\n readonly #incoming = new Map<string, RelationshipEdge[]>();\n\n /** Validate and index nodes and edges without reading tracker storage. */\n public constructor(\n nodes: Iterable<string>,\n edges: Iterable<RelationshipEdge>,\n registry: RelationshipKindRegistry = defaultRegistry,\n ) {\n this.#registry = registry;\n this.#nodes = new Set(\n [...nodes]\n .filter((id): id is string => typeof id === \"string\")\n .map((id) => id.trim())\n .filter(Boolean),\n );\n this.#nodeSnapshot = Object.freeze([...this.#nodes].sort());\n const deduped = new Map<string, RelationshipEdge>();\n for (const candidate of edges) {\n const { edge, identity } = normalizeRelationshipEdge(\n candidate,\n this.#nodes,\n registry,\n );\n deduped.set(identity, edge);\n }\n this.#edges = Object.freeze([...deduped.values()].sort(compareEdges));\n for (const edge of this.#edges) {\n appendIndexedEdge(this.#outgoing, edge.source, edge);\n appendIndexedEdge(this.#incoming, edge.target, edge);\n if (registry.require(edge.kind).direction === \"undirected\") {\n appendIndexedEdge(this.#outgoing, edge.target, edge);\n appendIndexedEdge(this.#incoming, edge.source, edge);\n }\n }\n }\n\n /** Build the graph directly from item metadata, including hierarchy and legacy blocker fields. */\n public static fromItems(\n items: readonly Pick<\n ItemMetadata,\n \"id\" | \"parent\" | \"blocked_by\" | \"dependencies\"\n >[],\n registry: RelationshipKindRegistry = defaultRegistry,\n ): RelationshipGraph {\n const ids = new Set(\n items.map((item) => normalizeNodeId(item.id)).filter(Boolean),\n );\n const edges: RelationshipEdge[] = [];\n for (const item of items) {\n const source = normalizeNodeId(item.id);\n if (!source) continue;\n const parent = resolveExistingNodeId(item.parent, ids);\n if (parent) edges.push({ source, target: parent, kind: \"parent\" });\n const blockedBy = resolveExistingNodeId(item.blocked_by, ids);\n if (blockedBy)\n edges.push({\n source,\n target: blockedBy,\n kind: \"blocked_by\",\n });\n for (const dependency of item.dependencies ?? []) {\n const dependencyId = resolveExistingNodeId(dependency.id, ids);\n if (dependencyId && registry.resolve(dependency.kind))\n edges.push({\n source,\n target: dependencyId,\n kind: dependency.kind,\n createdAt: dependency.created_at,\n author: dependency.author,\n });\n }\n }\n return new RelationshipGraph(ids, edges, registry);\n }\n\n /** Return the deterministic immutable edge snapshot. */\n public edges(): readonly RelationshipEdge[] {\n return this.#edges;\n }\n\n /** Return the deterministic immutable edges incident to one node. */\n public incidentEdges(id: string): readonly RelationshipEdge[] {\n this.#assertNode(id);\n // Preserve empty fallbacks for legacy indexes and JSON-derived graph state.\n const outgoing = this.#outgoing.get(id) ?? [];\n const incoming = this.#incoming.get(id) ?? [];\n if (outgoing.length === 0) return Object.freeze([...incoming]);\n if (incoming.length === 0) return Object.freeze([...outgoing]);\n const edges: RelationshipEdge[] = [];\n let outgoingIndex = 0;\n let incomingIndex = 0;\n while (outgoingIndex < outgoing.length || incomingIndex < incoming.length) {\n const outgoingEdge = outgoing[outgoingIndex];\n const incomingEdge = incoming[incomingIndex];\n const edge =\n outgoingEdge === undefined\n ? incomingEdge!\n : incomingEdge === undefined ||\n compareEdges(outgoingEdge, incomingEdge) <= 0\n ? outgoingEdge\n : incomingEdge;\n if (edges.at(-1) !== edge) edges.push(edge);\n if (outgoingEdge === edge) outgoingIndex += 1;\n if (incomingEdge === edge) incomingIndex += 1;\n }\n return Object.freeze(edges);\n }\n\n /** Return the deterministic immutable node snapshot. */\n public nodes(): readonly string[] {\n return this.#nodeSnapshot;\n }\n\n #assertNode(id: string): void {\n if (!this.#nodes.has(id))\n throw new TypeError(`Relationship node not found: ${id}`);\n }\n\n #matchesKinds(\n edge: RelationshipEdge,\n kinds: ReadonlySet<string> | undefined,\n ): boolean {\n if (!kinds) return true;\n const definition = this.#registry.require(edge.kind);\n return (\n kinds.has(edge.kind) ||\n (definition.inverse !== undefined && kinds.has(definition.inverse))\n );\n }\n\n #neighbors(\n id: string,\n direction: RelationshipTraversalDirection,\n kinds: ReadonlySet<string> | undefined,\n ): { id: string; edge: RelationshipEdge }[] {\n const candidates = [\n ...(direction === \"incoming\" ? [] : (this.#outgoing.get(id) ?? [])),\n ...(direction === \"outgoing\" ? [] : (this.#incoming.get(id) ?? [])),\n ];\n return [...new Set(candidates)]\n .filter((edge) => this.#matchesKinds(edge, kinds))\n .map((edge) => ({\n id: edge.source === id ? edge.target : edge.source,\n edge,\n }))\n .sort(\n (left, right) =>\n left.id.localeCompare(right.id) ||\n compareEdges(left.edge, right.edge),\n );\n }\n\n /** Return one-hop adjacent node identifiers. */\n public adjacency(\n id: string,\n options: RelationshipQueryOptions = {},\n ): RelationshipQueryResult<string[]> {\n this.#assertNode(id);\n options.signal?.throwIfAborted();\n const kinds = options.kinds\n ? new Set(options.kinds.map((kind) => this.#registry.require(kind).kind))\n : undefined;\n const rows = this.#neighbors(id, options.direction ?? \"outgoing\", kinds);\n const limit = options.limit ?? Number.POSITIVE_INFINITY;\n const uniqueNeighbors = [...new Set(rows.map((row) => row.id))];\n const value = uniqueNeighbors.slice(0, limit);\n return {\n value,\n meta: {\n visitedNodes: 1,\n inspectedEdges: rows.length,\n truncated: value.length < uniqueNeighbors.length,\n nextCursor: value.at(-1),\n },\n };\n }\n\n /** Return bounded transitive closure in breadth-first discovery order. */\n public closure(\n id: string,\n options: RelationshipQueryOptions = {},\n ): RelationshipQueryResult<string[]> {\n this.#assertNode(id);\n const kinds = options.kinds\n ? new Set(options.kinds.map((kind) => this.#registry.require(kind).kind))\n : undefined;\n const direction = options.direction ?? \"outgoing\";\n const limit = options.limit ?? Number.POSITIVE_INFINITY;\n const maxDepth = options.maxDepth ?? Number.POSITIVE_INFINITY;\n const seen = new Set([id]);\n const value: string[] = [];\n const queue = [{ id, depth: 0 }];\n let visitedNodes = 0;\n let inspectedEdges = 0;\n let truncated = false;\n traversal: for (let index = 0; index < queue.length; index += 1) {\n options.signal?.throwIfAborted();\n const current = queue[index]!;\n visitedNodes += 1;\n const neighbors = this.#neighbors(current.id, direction, kinds);\n inspectedEdges += neighbors.length;\n if (current.depth >= maxDepth) {\n if (neighbors.some((neighbor) => !seen.has(neighbor.id)))\n truncated = true;\n continue;\n }\n for (const neighbor of neighbors) {\n if (seen.has(neighbor.id)) continue;\n if (value.length >= limit) {\n truncated = true;\n break traversal;\n }\n seen.add(neighbor.id);\n value.push(neighbor.id);\n queue.push({ id: neighbor.id, depth: current.depth + 1 });\n }\n }\n return {\n value,\n meta: {\n visitedNodes,\n inspectedEdges,\n truncated,\n nextCursor: value.at(-1),\n },\n };\n }\n\n /** Return a deterministic shortest path, or an empty array when disconnected. */\n public shortestPath(\n source: string,\n target: string,\n options: RelationshipQueryOptions = {},\n ): RelationshipQueryResult<string[]> {\n this.#assertNode(source);\n this.#assertNode(target);\n if (source === target)\n return {\n value: [source],\n meta: { visitedNodes: 1, inspectedEdges: 0, truncated: false },\n };\n const kinds = options.kinds\n ? new Set(options.kinds.map((kind) => this.#registry.require(kind).kind))\n : undefined;\n const direction = options.direction ?? \"outgoing\";\n const maxDepth = options.maxDepth ?? Number.POSITIVE_INFINITY;\n const queue = [{ id: source, depth: 0 }];\n const parents = new Map<string, string>();\n const seen = new Set([source]);\n let visitedNodes = 0;\n let inspectedEdges = 0;\n let truncated = false;\n for (let index = 0; index < queue.length; index += 1) {\n options.signal?.throwIfAborted();\n const current = queue[index]!;\n visitedNodes += 1;\n const neighbors = this.#neighbors(current.id, direction, kinds);\n inspectedEdges += neighbors.length;\n if (current.depth >= maxDepth) {\n if (neighbors.some((neighbor) => !seen.has(neighbor.id)))\n truncated = true;\n continue;\n }\n for (const neighbor of neighbors) {\n if (seen.has(neighbor.id)) continue;\n parents.set(neighbor.id, current.id);\n if (neighbor.id === target)\n return {\n value: reconstructPath(source, target, parents),\n meta: { visitedNodes, inspectedEdges, truncated: false },\n };\n seen.add(neighbor.id);\n queue.push({ id: neighbor.id, depth: current.depth + 1 });\n }\n }\n return {\n value: [],\n meta: { visitedNodes, inspectedEdges, truncated },\n };\n }\n\n /** Return the induced subgraph over a bounded closure including the root. */\n public subgraph(\n id: string,\n options: RelationshipQueryOptions = {},\n ): RelationshipQueryResult<RelationshipSubgraph> {\n const closure = this.closure(id, options);\n const nodes = [id, ...closure.value].sort();\n const included = new Set(nodes);\n const kinds = options.kinds\n ? new Set(options.kinds.map((kind) => this.#registry.require(kind).kind))\n : undefined;\n const edges = new Set<RelationshipEdge>();\n for (const node of nodes) {\n for (const edge of this.#outgoing.get(node) ?? []) {\n if (\n included.has(edge.source) &&\n included.has(edge.target) &&\n this.#matchesKinds(edge, kinds)\n )\n edges.add(edge);\n }\n }\n return {\n value: {\n nodes,\n edges: [...edges].sort(compareEdges),\n },\n meta: closure.meta,\n };\n }\n}\n\n/** Convert one stored dependency into the public relationship edge contract. */\nexport function dependencyToRelationship(\n source: string,\n dependency: Dependency,\n registry: RelationshipKindRegistry = defaultRegistry,\n): RelationshipEdge {\n return {\n source,\n target: dependency.id,\n kind: registry.require(dependency.kind).kind,\n createdAt: dependency.created_at,\n author: dependency.author,\n };\n}\n", "/**\n * @module sdk/relationship-context\n *\n * Assembles one explainable, cursorable, token-bounded relationship context\n * packet for agents, custom tools, and presentation-layer adapters.\n */\nimport {\n createQueryFingerprint,\n encodeQueryCursor,\n resolveQueryCursorStart,\n} from \"./pagination.js\";\nimport {\n RelationshipGraph,\n RelationshipKindRegistry,\n createRelationshipKindRegistry,\n type RelationshipEdge,\n type RelationshipTraversalDirection,\n} from \"./relationships.js\";\n\n/** Caller-owned compact node details joined into graph context. */\nexport interface RelationshipContextNodeDetails {\n /** Stable graph node identifier. */\n id: string;\n /** Optional display title. */\n title?: string;\n /** Optional lifecycle status. */\n status?: string;\n /** Optional evidence pointers such as files, tests, or history ids. */\n evidence?: readonly string[];\n}\n\n/** One selected graph-context node with explainable inclusion. */\nexport interface RelationshipContextNode extends RelationshipContextNodeDetails {\n /** Shortest bounded distance from the root. */\n distance: number;\n /** Concise deterministic reasons the node was selected. */\n reasons: string[];\n}\n\n/** Controls for bounded graph-context assembly. */\nexport interface RelationshipContextOptions {\n /** Traversal direction relative to each visited node. */\n direction?: RelationshipTraversalDirection;\n /** Optional registered kind filter. */\n kinds?: readonly string[];\n /** Maximum traversal depth. */\n maxDepth?: number;\n /** Maximum nodes returned in this page. */\n nodeLimit?: number;\n /** Maximum edges returned in this page. */\n edgeLimit?: number;\n /** Maximum estimated output tokens charged to rows and edges. */\n tokenBudget?: number;\n /** Opaque continuation from an equivalent query. */\n cursor?: string;\n /** Registry used to explain custom relationship semantics. */\n registry?: RelationshipKindRegistry;\n /** Abort signal checked during traversal. */\n signal?: AbortSignal;\n}\n\n/** Explainable graph context packet. */\nexport interface RelationshipContextResult {\n /** Root node details. */\n root: RelationshipContextNodeDetails;\n /** Bounded related-node page. */\n nodes: RelationshipContextNode[];\n /** Bounded edges whose endpoints are present in the packet. */\n edges: RelationshipEdge[];\n /** Root evidence pointers promoted for immediate consumption. */\n evidence: string[];\n /** Completeness, continuation, and cost envelope. */\n meta: {\n exact: true;\n truncated: boolean;\n nodeLimit: number;\n edgeLimit: number;\n tokenBudget: number;\n usedTokens: number;\n visitedNodes: number;\n inspectedEdges: number;\n omittedNodes: number;\n omittedEdges: number;\n nextCursor?: string;\n };\n}\n\ninterface DiscoveredNode {\n id: string;\n distance: number;\n}\n\nconst tokenEncoder = new TextEncoder();\n\nfunction positiveInteger(\n value: number | undefined,\n fallback: number,\n field: string,\n): number {\n const resolved = value ?? fallback;\n if (!Number.isInteger(resolved) || resolved < 1)\n throw new TypeError(`Relationship context ${field} must be positive`);\n return resolved;\n}\n\nfunction estimateTokens(value: unknown): number {\n return Math.max(\n 1,\n Math.ceil(tokenEncoder.encode(JSON.stringify(value)).byteLength / 4),\n );\n}\n\nfunction explainDirectEdge(\n edge: RelationshipEdge,\n root: string,\n node: string,\n registry: RelationshipKindRegistry,\n): string {\n const definition = registry.require(edge.kind);\n if (definition.ordering) {\n // Legacy and JSON-parsed definitions may predate explicit precedence.\n const sourceFirst =\n (definition.precedence ?? \"source_before_target\") ===\n \"source_before_target\";\n const before = sourceFirst ? edge.source : edge.target;\n return node === before ? \"prerequisite\" : \"dependent\";\n }\n if (definition.hierarchy) {\n // Legacy and JSON-parsed definitions may predate explicit hierarchy direction.\n const sourceIsParent =\n (definition.hierarchyDirection ?? \"source_parent\") === \"source_parent\";\n const parent = sourceIsParent ? edge.source : edge.target;\n return node === parent ? \"ancestor\" : \"descendant\";\n }\n if (edge.kind === \"discovered_from\" || edge.kind === \"incident_from\")\n return \"provenance\";\n return \"related\";\n}\n\nfunction directReasons(\n rootEdges: readonly RelationshipEdge[],\n root: string,\n node: string,\n registry: RelationshipKindRegistry,\n): string[] {\n const reasons = rootEdges\n .filter(\n (edge) =>\n (edge.source === root && edge.target === node) ||\n (edge.target === root && edge.source === node),\n )\n .map((edge) => explainDirectEdge(edge, root, node, registry));\n return [...new Set(reasons)].sort();\n}\n\nfunction discoverNodes(\n graph: RelationshipGraph,\n root: string,\n options: RelationshipContextOptions,\n): {\n rows: DiscoveredNode[];\n visitedNodes: number;\n inspectedEdges: number;\n depthTruncated: boolean;\n} {\n const direction = options.direction ?? \"both\";\n const maxDepth = options.maxDepth ?? 3;\n if (!Number.isInteger(maxDepth) || maxDepth < 0)\n throw new TypeError(\"Relationship context maxDepth must be non-negative\");\n const seen = new Set([root]);\n const queue = [{ id: root, distance: 0 }];\n const rows: DiscoveredNode[] = [];\n let inspectedEdges = 0;\n let depthTruncated = false;\n for (let index = 0; index < queue.length; index += 1) {\n options.signal?.throwIfAborted();\n const current = queue[index]!;\n if (current.distance >= maxDepth && depthTruncated) continue;\n const adjacent = graph.adjacency(current.id, {\n direction,\n kinds: options.kinds,\n signal: options.signal,\n });\n inspectedEdges += adjacent.meta.inspectedEdges;\n if (current.distance >= maxDepth) {\n if (adjacent.value.some((id) => !seen.has(id))) depthTruncated = true;\n continue;\n }\n for (const id of adjacent.value) {\n if (seen.has(id)) continue;\n seen.add(id);\n const row = { id, distance: current.distance + 1 };\n rows.push(row);\n queue.push(row);\n }\n }\n rows.sort(\n (left, right) =>\n left.distance - right.distance || left.id.localeCompare(right.id),\n );\n return {\n rows,\n visitedNodes: queue.length,\n inspectedEdges,\n depthTruncated,\n };\n}\n\nfunction selectContextNodes(params: {\n candidates: readonly DiscoveredNode[];\n details: ReadonlyMap<string, RelationshipContextNodeDetails>;\n graph: RelationshipGraph;\n rootId: string;\n registry: RelationshipKindRegistry;\n nodeLimit: number;\n tokenBudget: number;\n initialTokens: number;\n}): { nodes: RelationshipContextNode[]; usedTokens: number } {\n const nodes: RelationshipContextNode[] = [];\n let usedTokens = params.initialTokens;\n const rootEdges = params.graph.incidentEdges(params.rootId);\n for (const candidate of params.candidates) {\n if (nodes.length >= params.nodeLimit) break;\n const node: RelationshipContextNode = {\n ...(params.details.get(candidate.id) ?? { id: candidate.id }),\n distance: candidate.distance,\n reasons:\n candidate.distance === 1\n ? directReasons(\n rootEdges,\n params.rootId,\n candidate.id,\n params.registry,\n )\n : [`reachable at depth ${candidate.distance}`],\n };\n const cost = estimateTokens(node);\n if (usedTokens + cost > params.tokenBudget) break;\n nodes.push(node);\n usedTokens += cost;\n }\n if (params.candidates.length > 0 && nodes.length === 0)\n throw new TypeError(\"Relationship context tokenBudget cannot fit one node\");\n return { nodes, usedTokens };\n}\n\nfunction selectContextEdges(params: {\n graph: RelationshipGraph;\n included: ReadonlySet<string>;\n edgeLimit: number;\n tokenBudget: number;\n initialTokens: number;\n}): {\n edges: RelationshipEdge[];\n usedTokens: number;\n candidateCount: number;\n} {\n const candidates = params.graph\n .edges()\n .filter(\n (edge) =>\n params.included.has(edge.source) && params.included.has(edge.target),\n );\n const edges: RelationshipEdge[] = [];\n let usedTokens = params.initialTokens;\n for (const edge of candidates) {\n if (edges.length >= params.edgeLimit) break;\n const cost = estimateTokens(edge);\n if (usedTokens + cost > params.tokenBudget) break;\n edges.push(edge);\n usedTokens += cost;\n }\n return { edges, usedTokens, candidateCount: candidates.length };\n}\n\n/** Build one deterministic bounded graph-context packet with continuation. */\nexport function buildRelationshipContext(\n graph: RelationshipGraph,\n rootId: string,\n details: readonly RelationshipContextNodeDetails[],\n options: RelationshipContextOptions = {},\n): RelationshipContextResult {\n if (!graph.nodes().includes(rootId))\n throw new TypeError(`Relationship node not found: ${rootId}`);\n const nodeLimit = positiveInteger(options.nodeLimit, 20, \"nodeLimit\");\n const edgeLimit = positiveInteger(options.edgeLimit, 40, \"edgeLimit\");\n const tokenBudget = positiveInteger(options.tokenBudget, 1200, \"tokenBudget\");\n const registry = options.registry ?? createRelationshipKindRegistry();\n const byId = new Map(details.map((detail) => [detail.id, detail]));\n const rootDetails: RelationshipContextNodeDetails = byId.get(rootId) ?? {\n id: rootId,\n };\n const { evidence: rootEvidence = [], ...root } = rootDetails;\n const evidence = [...rootEvidence];\n const discovery = discoverNodes(graph, rootId, options);\n const fingerprint = createQueryFingerprint(\"relationship-context\", {\n rootId,\n direction: options.direction ?? \"both\",\n kinds: [...(options.kinds ?? [])].sort(),\n maxDepth: options.maxDepth ?? 3,\n });\n const pageStart = resolveQueryCursorStart(\n discovery.rows,\n options.cursor,\n fingerprint,\n ({ id }) => id,\n );\n const candidates = discovery.rows.slice(pageStart);\n const initialTokens = estimateTokens(root) + estimateTokens(evidence);\n if (initialTokens > tokenBudget)\n throw new TypeError(\n \"Relationship context tokenBudget cannot fit root and evidence\",\n );\n const nodeSelection = selectContextNodes({\n candidates,\n details: byId,\n graph,\n rootId,\n registry,\n nodeLimit,\n tokenBudget,\n initialTokens,\n });\n const { nodes } = nodeSelection;\n\n const included = new Set([rootId, ...nodes.map(({ id }) => id)]);\n const edgeSelection = selectContextEdges({\n graph,\n included,\n edgeLimit,\n tokenBudget,\n initialTokens: nodeSelection.usedTokens,\n });\n const { edges, usedTokens } = edgeSelection;\n\n const consumed = pageStart + nodes.length;\n const hasMoreNodes = consumed < discovery.rows.length;\n const lastNode = nodes.at(-1);\n const omittedEdges = edgeSelection.candidateCount - edges.length;\n const truncated =\n discovery.depthTruncated || hasMoreNodes || omittedEdges > 0;\n return {\n root,\n nodes,\n edges,\n evidence,\n meta: {\n exact: true,\n truncated,\n nodeLimit,\n edgeLimit,\n tokenBudget,\n usedTokens,\n visitedNodes: discovery.visitedNodes,\n inspectedEdges: discovery.inspectedEdges,\n omittedNodes: discovery.rows.length - consumed,\n omittedEdges,\n ...(hasMoreNodes && lastNode\n ? {\n nextCursor: encodeQueryCursor(\n fingerprint,\n lastNode.id,\n consumed - 1,\n ),\n }\n : {}),\n },\n };\n}\n", "/**\n * @module sdk/dependencies\n *\n * Implements the pm deps command surface and its agent-facing runtime behavior.\n */\nimport { getActiveExtensionRegistrations } from \"../core/extensions/index.js\";\nimport { pathExists } from \"../core/fs/fs-utils.js\";\nimport { resolveItemTypeRegistry } from \"../core/item/type-registry.js\";\nimport { isTerminalStatus } from \"../core/item/status.js\";\nimport { resolveRuntimeStatusRegistry } from \"../core/schema/runtime-schema.js\";\nimport { EXIT_CODE } from \"../core/shared/constants.js\";\nimport type { GlobalOptions } from \"../core/shared/command-types.js\";\nimport { PmCliError } from \"../core/shared/errors.js\";\nimport { listAllItemMetadataLight } from \"../core/store/item-store.js\";\nimport { getSettingsPath, resolvePmRoot } from \"../core/store/paths.js\";\nimport { readSettings } from \"../core/store/settings.js\";\nimport type {\n Dependency,\n ItemMetadata,\n ItemStatus,\n ItemType,\n} from \"../types/index.js\";\nimport {\n buildRelationshipContext,\n type RelationshipContextResult,\n} from \"./relationship-context.js\";\nimport { RelationshipGraph } from \"./relationships.js\";\n\n/** Supported values accepted by the deps format contract. */\nexport const DEPS_FORMAT_VALUES = [\"tree\", \"graph\", \"context\"] as const;\n/** Restricts deps format values accepted by command, SDK, and storage contracts. */\nexport type DepsFormat = (typeof DEPS_FORMAT_VALUES)[number];\n/** Supported values accepted by the deps collapse contract. */\nexport const DEPS_COLLAPSE_VALUES = [\"none\", \"repeated\"] as const;\n/** Restricts deps collapse mode values accepted by command, SDK, and storage contracts. */\nexport type DepsCollapseMode = (typeof DEPS_COLLAPSE_VALUES)[number];\n\n/** Documents the deps command options payload exchanged by command, SDK, and package integrations. */\nexport interface DepsCommandOptions {\n /** Value that configures or reports format for this contract. */\n format?: string;\n /** Value that configures or reports max depth for this contract. */\n maxDepth?: string | number;\n /** Value that configures or reports collapse for this contract. */\n collapse?: string;\n /** Value that configures or reports summary for this contract. */\n summary?: boolean;\n /** Maximum graph-context nodes returned. */\n nodeLimit?: string | number;\n /** Maximum graph-context edges returned. */\n edgeLimit?: string | number;\n /** Maximum estimated graph-context output tokens. */\n tokenBudget?: string | number;\n /** Opaque continuation cursor for graph-context output. */\n cursor?: string;\n}\n\ninterface IndexedItem {\n id: string;\n title: string;\n type: ItemType;\n status: ItemStatus;\n dependencies: IndexedDependency[];\n}\n\ninterface IndexedDependency {\n id: string;\n kind: string;\n}\n\n/** Minimal item shape inspected by dependency-reference governance. */\nexport interface DependencyReferenceHolder {\n /** Stable item identifier. */\n id: string;\n /** Lifecycle status used to separate actionable work from historical debt. */\n status: ItemStatus;\n /** Optional hierarchy parent reference. */\n parent?: string;\n /** Optional legacy scalar blocker reference. */\n blocked_by?: string;\n /** Structured dependency edges. */\n dependencies?: Dependency[];\n}\n\n/** Storage surface that contributed a normalized dependency reference. */\nexport type DependencyReferenceSource = \"parent\" | \"blocked_by\" | \"dependency\";\n\n/** One normalized dependency reference whose target is absent from the tracker. */\nexport interface DanglingDependencyReference {\n /** Item that owns the reference. */\n holder_id: string;\n /** Missing referenced item id or legacy sentinel. */\n target_id: string;\n /** Relationship field or dependency kind. */\n kind: string;\n /** Storage surface that owns the reference and determines its remediation. */\n source: DependencyReferenceSource;\n /** Current lifecycle status of the holder. */\n holder_status: ItemStatus;\n /** Whether the holder is terminal and therefore historical, non-actionable debt. */\n legacy_terminal: boolean;\n /** Whether the target is the pre-structured-dependency `no-active-blocker` sentinel. */\n no_active_blocker_sentinel: boolean;\n}\n\n/** Actionable and historical partitions returned by dependency-reference governance. */\nexport interface DanglingDependencyReferenceSummary {\n /** Missing references held by active items; these may affect scheduling and should gate validation. */\n active: DanglingDependencyReference[];\n /** Missing references held only by terminal items; retained as informational history debt. */\n legacy_terminal: DanglingDependencyReference[];\n /** Legacy sentinel rows across active and terminal holders, called out separately from typo-like ids. */\n no_active_blocker_sentinels: DanglingDependencyReference[];\n}\n\n/** Normalize a decoded reference target and reject empty legacy placeholders. */\nfunction normalizeDependencyReferenceTarget(target: unknown): string | undefined {\n if (typeof target !== \"string\") return undefined;\n const normalized = target.trim();\n if (!normalized || [\"none\", \"null\", \"n/a\", \"na\"].includes(normalized.toLowerCase())) return undefined;\n return normalized;\n}\n\n/** Normalize a graph target while removing the historical no-blocker marker. */\nfunction normalizeDependencyGraphTarget(target: unknown): string | undefined {\n const normalized = normalizeDependencyReferenceTarget(target);\n return normalized?.toLowerCase() === \"no-active-blocker\" ? undefined : normalized;\n}\n\n/**\n * Classify missing hierarchy and dependency targets without mutating their holders.\n *\n * Consumers provide the workspace's terminal-status predicate so custom lifecycle\n * schemas receive the same active-versus-historical behavior as the built-in\n * closed/canceled statuses.\n */\nexport function collectDanglingDependencyReferences(\n items: readonly DependencyReferenceHolder[],\n isTerminal: (status: ItemStatus) => boolean = (status) =>\n status === \"closed\" || status === \"canceled\",\n): DanglingDependencyReferenceSummary {\n const knownIds = new Set(items.map((item) => item.id.trim().toLowerCase()));\n const rows = new Map<string, DanglingDependencyReference>();\n const addReference = (\n item: DependencyReferenceHolder,\n target: unknown,\n kind: string,\n source: DependencyReferenceSource,\n ): void => {\n const normalized = normalizeDependencyReferenceTarget(target);\n if (!normalized || knownIds.has(normalized.toLowerCase())) {\n return;\n }\n const row: DanglingDependencyReference = {\n holder_id: item.id,\n target_id: normalized,\n kind,\n source,\n holder_status: item.status,\n legacy_terminal: isTerminal(item.status),\n no_active_blocker_sentinel:\n normalized.toLowerCase() === \"no-active-blocker\",\n };\n rows.set(\n `${row.holder_id}::${row.target_id}::${row.kind}::${row.source}`,\n row,\n );\n };\n for (const item of items) {\n addReference(item, item.parent, \"parent\", \"parent\");\n addReference(item, item.blocked_by, \"blocked_by\", \"blocked_by\");\n for (const dependency of item.dependencies ?? []) {\n // Public SDK callers may supply legacy or JSON-decoded payloads that do\n // not yet satisfy the current structured dependency contract.\n if (typeof dependency !== \"object\" || dependency === null) {\n continue;\n }\n const legacyDependency = dependency as Partial<Dependency>;\n addReference(\n item,\n legacyDependency.id,\n typeof legacyDependency.kind === \"string\"\n ? legacyDependency.kind\n : \"related\",\n \"dependency\",\n );\n }\n }\n const sorted = [...rows.values()].sort(\n (left, right) =>\n left.holder_id.localeCompare(right.holder_id) ||\n left.target_id.localeCompare(right.target_id) ||\n left.kind.localeCompare(right.kind) ||\n left.source.localeCompare(right.source),\n );\n const legacyTerminal = sorted.filter((row) => row.legacy_terminal);\n return {\n active: sorted.filter((row) => !row.legacy_terminal),\n legacy_terminal: legacyTerminal,\n no_active_blocker_sentinels: sorted.filter(\n (row) => row.no_active_blocker_sentinel,\n ),\n };\n}\n\n/** Return unique real missing targets while excluding the legacy no-blocker sentinel. */\nfunction collectMissingDependencyTargetIds(\n dangling: DanglingDependencyReferenceSummary,\n): string[] {\n const targets = new Map<string, string>();\n for (const reference of [...dangling.active, ...dangling.legacy_terminal]) {\n if (reference.no_active_blocker_sentinel) continue;\n const target = reference.target_id.trim();\n const key = target.toLowerCase();\n if (!targets.has(key)) targets.set(key, target);\n }\n return [...targets.values()].sort((left, right) => left.localeCompare(right));\n}\n\n/** Documents the deps tree node payload exchanged by command, SDK, and package integrations. */\nexport interface DepsTreeNode {\n /** Stable identifier used to reference this record across commands and storage. */\n id: string;\n /** Value that configures or reports title for this contract. */\n title?: string;\n /** Schema type that determines the shape and validation rules for this value. */\n type?: ItemType;\n /** Lifecycle state reported for status. */\n status?: ItemStatus;\n /** Value that configures or reports via for this contract. */\n via?: string;\n /** Value that configures or reports missing for this contract. */\n missing: boolean;\n /** Value that configures or reports cycle for this contract. */\n cycle: boolean;\n /** Value that configures or reports truncated for this contract. */\n truncated?: boolean;\n /** Value that configures or reports collapsed for this contract. */\n collapsed?: boolean;\n /** Value that configures or reports dependencies for this contract. */\n dependencies: DepsTreeNode[];\n}\n\n/** Documents the deps graph node payload exchanged by command, SDK, and package integrations. */\nexport interface DepsGraphNode {\n /** Stable identifier used to reference this record across commands and storage. */\n id: string;\n /** Value that configures or reports title for this contract. */\n title?: string;\n /** Schema type that determines the shape and validation rules for this value. */\n type?: ItemType;\n /** Lifecycle state reported for status. */\n status?: ItemStatus;\n /** Value that configures or reports missing for this contract. */\n missing: boolean;\n}\n\n/** Documents the deps graph edge payload exchanged by command, SDK, and package integrations. */\nexport interface DepsGraphEdge {\n /** Value that configures or reports from for this contract. */\n from: string;\n /** Value that configures or reports to for this contract. */\n to: string;\n /** Value that configures or reports kind for this contract. */\n kind: string;\n}\n\n/** Documents the deps graph result payload exchanged by command, SDK, and package integrations. */\nexport interface DepsGraphResult {\n /** Value that configures or reports root id for this contract. */\n root_id: string;\n /** Value that configures or reports nodes for this contract. */\n nodes: DepsGraphNode[];\n /** Value that configures or reports edges for this contract. */\n edges: DepsGraphEdge[];\n /** Value that configures or reports missing ids for this contract. */\n missing_ids: string[];\n}\n\n/** Documents the deps result payload exchanged by command, SDK, and package integrations. */\nexport interface DepsResult {\n /** Stable identifier used to reference this record across commands and storage. */\n id: string;\n /** Value that configures or reports format for this contract. */\n format: DepsFormat;\n /** Number of node entries represented by this result. */\n node_count: number;\n /** Number of edge entries represented by this result. */\n edge_count: number;\n /** Number of missing entries represented by this result. */\n missing_count: number;\n /** Value that configures or reports tree for this contract. */\n tree?: DepsTreeNode;\n /** Value that configures or reports graph for this contract. */\n graph?: DepsGraphResult;\n /** Explainable bounded graph-context projection. */\n context?: RelationshipContextResult;\n}\n\nfunction parseFormat(raw: string | undefined): DepsFormat {\n const candidate = raw?.trim().toLowerCase() ?? \"tree\";\n if ((DEPS_FORMAT_VALUES as readonly string[]).includes(candidate)) {\n return candidate as DepsFormat;\n }\n throw new PmCliError(\n `Invalid --format value \"${raw}\". Use \"tree\", \"graph\", or \"context\".`,\n EXIT_CODE.USAGE,\n );\n}\n\nfunction parsePositiveInteger(raw: string | number | undefined, flag: string): number | undefined {\n if (raw === undefined) return undefined;\n const value = typeof raw === \"number\" ? raw : Number(raw.trim());\n if (!Number.isInteger(value) || value < 1)\n throw new PmCliError(`Invalid --${flag} value \"${raw}\". Use a positive integer.`, EXIT_CODE.USAGE);\n return value;\n}\n\nfunction parseMaxDepth(raw: string | number | undefined): number | undefined {\n if (raw === undefined) {\n return undefined;\n }\n const normalized = typeof raw === \"number\" ? raw : Number(raw.trim());\n if (!Number.isInteger(normalized) || normalized < 0) {\n throw new PmCliError(\n `Invalid --max-depth value \"${raw}\". Use a non-negative integer.`,\n EXIT_CODE.USAGE,\n );\n }\n return normalized;\n}\n\nfunction parseCollapse(raw: string | undefined): DepsCollapseMode {\n const candidate = raw?.trim().toLowerCase() ?? \"none\";\n if ((DEPS_COLLAPSE_VALUES as readonly string[]).includes(candidate)) {\n return candidate as DepsCollapseMode;\n }\n throw new PmCliError(\n `Invalid --collapse value \"${raw}\". Use \"none\" or \"repeated\".`,\n EXIT_CODE.USAGE,\n );\n}\n\nfunction normalizeDependencies(\n dependencies: Dependency[] | undefined,\n): IndexedDependency[] {\n if (!dependencies || dependencies.length === 0) {\n return [];\n }\n const sorted = dependencies.map(({ id, kind }) => ({\n id: id.trim(),\n kind: kind.trim().toLowerCase(),\n })).sort((left, right) => {\n const byKind = left.kind.localeCompare(right.kind);\n if (byKind !== 0) return byKind;\n return left.id.localeCompare(right.id);\n });\n const deduped = new Map<string, IndexedDependency>();\n for (const dependency of sorted) {\n const key = `${dependency.kind.toLowerCase()}::${dependency.id.toLowerCase()}`;\n if (!deduped.has(key)) {\n deduped.set(key, { id: dependency.id, kind: dependency.kind });\n }\n }\n return [...deduped.values()];\n}\n\nfunction toIndexedItem(item: ItemMetadata): IndexedItem {\n return {\n id: item.id,\n title: item.title,\n type: item.type,\n status: item.status,\n dependencies: normalizeDependencies(item.dependencies),\n };\n}\n\nfunction toTreeNode(\n id: string,\n index: Map<string, IndexedItem>,\n lineage: Set<string>,\n maxDepth: number | undefined,\n collapse: DepsCollapseMode,\n expanded: Set<string>,\n depth = 0,\n via?: string,\n): DepsTreeNode {\n const lookupId = id.trim().toLowerCase();\n const item = index.get(lookupId);\n const baseNode: DepsTreeNode = {\n id: item?.id ?? id,\n title: item?.title,\n type: item?.type,\n status: item?.status,\n via,\n missing: !item,\n cycle: lineage.has(lookupId),\n dependencies: [],\n };\n if (!item || baseNode.cycle) {\n return baseNode;\n }\n if (maxDepth !== undefined && depth >= maxDepth) {\n if (item.dependencies.length > 0) {\n baseNode.truncated = true;\n }\n return baseNode;\n }\n if (collapse === \"repeated\" && expanded.has(lookupId)) {\n baseNode.collapsed = true;\n return baseNode;\n }\n if (collapse === \"repeated\") {\n expanded.add(lookupId);\n }\n const nextLineage = new Set(lineage);\n nextLineage.add(lookupId);\n baseNode.dependencies = item.dependencies.map((dependency) =>\n toTreeNode(\n dependency.id,\n index,\n nextLineage,\n maxDepth,\n collapse,\n expanded,\n depth + 1,\n dependency.kind,\n ),\n );\n return baseNode;\n}\n\nfunction mergeGraphNode(\n existing: DepsGraphNode | undefined,\n candidate: DepsGraphNode,\n): DepsGraphNode {\n if (!existing) {\n return candidate;\n }\n /* c8 ignore start -- defensive: mixed missing/non-missing duplicates only occur in malformed synthetic trees. */\n if (existing.missing && !candidate.missing) return candidate;\n /* c8 ignore stop */\n return {\n ...existing,\n title: existing.title ?? candidate.title,\n type: existing.type ?? candidate.type,\n status: existing.status ?? candidate.status,\n };\n}\n\nfunction toGraph(root: DepsTreeNode): DepsGraphResult {\n const nodesById = new Map<string, DepsGraphNode>();\n const edgesByKey = new Map<string, DepsGraphEdge>();\n\n const visit = (node: DepsTreeNode): void => {\n nodesById.set(\n node.id,\n mergeGraphNode(nodesById.get(node.id), {\n id: node.id,\n title: node.title,\n type: node.type,\n status: node.status,\n missing: node.missing,\n }),\n );\n for (const child of node.dependencies) {\n nodesById.set(\n child.id,\n mergeGraphNode(nodesById.get(child.id), {\n id: child.id,\n title: child.title,\n type: child.type,\n status: child.status,\n missing: child.missing,\n }),\n );\n /* c8 ignore start -- legacy malformed dependency payloads may omit kind/via. */\n const relationKind = child.via ?? \"related\";\n const edgeKey = `${node.id}::${child.id}::${relationKind}`;\n if (!edgesByKey.has(edgeKey)) {\n edgesByKey.set(edgeKey, {\n from: node.id,\n to: child.id,\n kind: relationKind,\n });\n }\n /* c8 ignore stop */\n if (!child.cycle) {\n visit(child);\n }\n }\n };\n\n visit(root);\n\n const nodes = [...nodesById.values()].sort((left, right) =>\n left.id.localeCompare(right.id),\n );\n const edges = [...edgesByKey.values()].sort((left, right) => {\n const byFrom = left.from.localeCompare(right.from);\n if (byFrom !== 0) return byFrom;\n const byTo = left.to.localeCompare(right.to);\n if (byTo !== 0) return byTo;\n return left.kind.localeCompare(right.kind);\n });\n const missingIds = nodes\n .filter((node) => node.missing)\n .map((node) => node.id);\n return {\n root_id: root.id,\n nodes,\n edges,\n missing_ids: missingIds,\n };\n}\n\n/** Count a dependency result without allocating its potentially exponential tree payload. */\nfunction countDependencyGraph(\n rootId: string,\n index: Map<string, IndexedItem>,\n maxDepth: number | undefined,\n): Pick<DepsResult, \"node_count\" | \"edge_count\" | \"missing_count\"> {\n const nodeIds = new Set<string>();\n const edgeKeys = new Set<string>();\n const missingIds = new Set<string>();\n const expanded = new Set<string>();\n const pending = [{ id: rootId, depth: 0 }];\n let pendingIndex = 0;\n while (pendingIndex < pending.length) {\n const current = pending[pendingIndex++]!;\n const lookupId = current.id.trim().toLowerCase();\n nodeIds.add(lookupId);\n const item = index.get(lookupId);\n if (!item) {\n missingIds.add(lookupId);\n continue;\n }\n if (maxDepth !== undefined && current.depth >= maxDepth) {\n continue;\n }\n if (expanded.has(lookupId)) {\n continue;\n }\n expanded.add(lookupId);\n for (const dependency of item.dependencies) {\n edgeKeys.add(\n `${lookupId}::${dependency.id.trim().toLowerCase()}::${dependency.kind}`,\n );\n pending.push({ id: dependency.id, depth: current.depth + 1 });\n }\n }\n return {\n node_count: nodeIds.size,\n edge_count: edgeKeys.size,\n missing_count: missingIds.size,\n };\n}\n\n/** Build the SDK-backed bounded relationship-context projection for deps. */\nexport function buildDepsRelationshipContext(\n rootId: string,\n items: readonly ItemMetadata[],\n options: Pick<DepsCommandOptions, \"maxDepth\" | \"nodeLimit\" | \"edgeLimit\" | \"tokenBudget\" | \"cursor\">,\n): RelationshipContextResult {\n const maxDepth = parseMaxDepth(options.maxDepth);\n const nodeLimit = parsePositiveInteger(options.nodeLimit, \"node-limit\");\n const edgeLimit = parsePositiveInteger(options.edgeLimit, \"edge-limit\");\n const tokenBudget = parsePositiveInteger(options.tokenBudget, \"token-budget\");\n const canonicalIds = new Map(items.map((item) => [item.id.trim().toLowerCase(), item.id.trim()]));\n const dangling = collectDanglingDependencyReferences(items);\n const missingIds = collectMissingDependencyTargetIds(dangling);\n const graphItems = items.map((item) => {\n const parent = normalizeDependencyGraphTarget(item.parent);\n const blocker = normalizeDependencyGraphTarget(item.blocked_by);\n const dependencies = (item.dependencies ?? []).flatMap((rawDependency) => {\n if (typeof rawDependency !== \"object\" || rawDependency === null) return [];\n const dependency = rawDependency as Partial<Dependency>;\n const target = normalizeDependencyGraphTarget(dependency.id);\n if (!target) return [];\n return [{\n id: canonicalIds.get(target.toLowerCase()) ?? target,\n kind: typeof dependency.kind === \"string\" ? dependency.kind : \"related\",\n }];\n });\n return {\n id: item.id,\n ...(parent ? { parent: canonicalIds.get(parent.toLowerCase()) ?? parent } : {}),\n ...(blocker ? { blocked_by: canonicalIds.get(blocker.toLowerCase()) ?? blocker } : {}),\n dependencies,\n };\n });\n return buildRelationshipContext(\n RelationshipGraph.fromItems([...graphItems, ...missingIds.map((id) => ({ id }))]),\n rootId,\n [\n ...items.map((item) => ({ id: item.id, title: item.title, status: item.status })),\n ...missingIds.map((id) => ({ id, title: `[missing] ${id}`, status: \"missing\" })),\n ],\n {\n ...(maxDepth === undefined ? {} : { maxDepth }),\n ...(nodeLimit === undefined ? {} : { nodeLimit }),\n ...(edgeLimit === undefined ? {} : { edgeLimit }),\n ...(tokenBudget === undefined ? {} : { tokenBudget }),\n ...(options.cursor?.trim() ? { cursor: options.cursor.trim() } : {}),\n },\n );\n}\n\n/** Implements run deps for the public runtime surface of this module. */\nexport async function runDeps(\n id: string,\n options: DepsCommandOptions,\n global: GlobalOptions,\n): Promise<DepsResult> {\n const pmRoot = resolvePmRoot(process.cwd(), global.path);\n if (!(await pathExists(getSettingsPath(pmRoot)))) {\n throw new PmCliError(\n `Tracker is not initialized at ${pmRoot}. Run pm init first.`,\n EXIT_CODE.NOT_FOUND,\n );\n }\n const format = parseFormat(options.format);\n const maxDepth = parseMaxDepth(options.maxDepth);\n const collapse = parseCollapse(options.collapse);\n const summaryOnly = options.summary === true;\n const settings = await readSettings(pmRoot);\n const typeRegistry = resolveItemTypeRegistry(\n settings,\n getActiveExtensionRegistrations(),\n );\n const items = await listAllItemMetadataLight(\n pmRoot,\n settings.item_format,\n typeRegistry.type_to_folder,\n undefined,\n settings.schema,\n );\n const statusRegistry = resolveRuntimeStatusRegistry(settings.schema);\n const index = new Map(\n items.map((item) => [item.id.trim().toLowerCase(), toIndexedItem(item)]),\n );\n const dangling = collectDanglingDependencyReferences(\n items,\n (status) => isTerminalStatus(status, statusRegistry),\n );\n for (const reference of [...dangling.active, ...dangling.legacy_terminal]) {\n const holder = index.get(reference.holder_id.trim().toLowerCase());\n const referenceKind = reference.kind.trim().toLowerCase();\n if (\n holder &&\n !holder.dependencies.some(\n (dependency) =>\n dependency.id.trim().toLowerCase() === reference.target_id.trim().toLowerCase() &&\n dependency.kind === referenceKind,\n )\n ) {\n holder.dependencies.push({ id: reference.target_id, kind: referenceKind });\n }\n }\n if (!index.has(id.trim().toLowerCase())) {\n throw new PmCliError(`Item ${id} not found`, EXIT_CODE.NOT_FOUND);\n }\n\n if (format === \"context\") {\n const canonicalId = index.get(id.trim().toLowerCase())!.id;\n const context = buildDepsRelationshipContext(canonicalId, items, options);\n return {\n id: canonicalId,\n format,\n node_count: context.nodes.length + 1,\n edge_count: context.edges.length,\n missing_count: collectMissingDependencyTargetIds(dangling).length,\n ...(summaryOnly ? {} : { context }),\n };\n }\n\n if (summaryOnly) {\n return {\n id,\n format,\n ...countDependencyGraph(id, index, maxDepth),\n };\n }\n\n const tree = toTreeNode(\n id,\n index,\n new Set<string>(),\n maxDepth,\n collapse,\n new Set<string>(),\n );\n const graph = toGraph(tree);\n const baseResult = {\n id,\n format,\n node_count: graph.nodes.length,\n edge_count: graph.edges.length,\n missing_count: graph.missing_ids.length,\n };\n if (format === \"tree\") {\n return {\n ...baseResult,\n tree,\n };\n }\n return {\n ...baseResult,\n graph,\n };\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkHA,IAAM,6BAAoE;EACxE;IACE,MAAM;IACN,WAAW;IACX,SAAS;IACT,UAAU;IACV,YAAY;IACZ,WAAW;IACX,UAAU;IACV,UAAU;IACV,WAAW;IACX,SAAS,CAAC,YAAY;IACtB,sBA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A,UACA,oBAAI,IAAG,CAAU;AAEnB,QAAM,QAAQ,QAAQ,IAAI;AAC1B,QAAM,aAAa;IACjB;IACA;IACA,YAAY,MAAM,MAAM;IACxB,YAAY,MAAM,MAAM;IACxB,eAAe,MAAM,YAAY;;AAEnC,MAAI,WAAW,QAAQ;AACrB,WAAO;MACL,GAAG;MACH;;EAEJ;AACA,SAAO;IACL,GAAG;IACH;;AAEJ;",
6
- "names": ["global"]
7
- }
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../../../../cli/commands/close.ts"],"sourcesContent":["/**\n * @module cli/commands/close\n *\n * Implements the pm close command surface and its agent-facing runtime behavior.\n */\nimport { pathExists } from \"../../core/fs/fs-utils.js\";\nimport { collectBlockedByIds } from \"../../core/item/actionability.js\";\nimport { toItemRecord } from \"../../core/item/item-record.js\";\nimport { isTerminalStatus } from \"../../core/item/status.js\";\nimport { resolveItemTypeRegistry } from \"../../core/item/type-registry.js\";\nimport {\n resolveRuntimeStatusRegistry,\n type RuntimeStatusRegistry,\n} from \"../../core/schema/runtime-schema.js\";\nimport { EXIT_CODE } from \"../../core/shared/constants.js\";\nimport type { GlobalOptions } from \"../../core/shared/command-types.js\";\nimport { PmCliError } from \"../../core/shared/errors.js\";\nimport {\n buildItemNotFoundError,\n listAllItemMetadataLight,\n locateItem,\n mutateItem,\n readLocatedItem,\n} from \"../../core/store/item-store.js\";\nimport { getSettingsPath, resolvePmRoot } from \"../../core/store/paths.js\";\nimport { readSettings } from \"../../core/store/settings.js\";\nimport type { ItemMetadata } from \"../../types/index.js\";\n\n/** Documents the close command options payload exchanged by command, SDK, and package integrations. */\nexport interface CloseCommandOptions {\n /** Value that configures or reports author for this contract. */\n author?: string;\n /** Human-readable explanation suitable for logs and agent-facing output. */\n message?: string;\n /** Value that configures or reports validate close for this contract. */\n validateClose?: string;\n /** Value that configures or reports force for this contract. */\n force?: boolean;\n // pm-fl0c #11 (2026-05-28): allow setting the three closure validation\n // fields inline on `pm close` so agents do not have to issue a prior\n // `pm update` just to satisfy --validate-close warn|strict. These map 1:1\n // to ItemMetadata.{resolution,expected_result,actual_result}.\n /** Value that configures or reports resolution for this contract. */\n resolution?: string;\n /** Structured result returned by the expected operation. */\n expectedResult?: string;\n /** Structured result returned by the actual operation. */\n actualResult?: string;\n /** Value that configures or reports duplicate of for this contract. */\n duplicateOf?: string;\n}\n\n/** Documents the close result payload exchanged by command, SDK, and package integrations. */\nexport interface CloseResult {\n /** Value that configures or reports item for this contract. */\n item: Record<string, unknown>;\n /** Value that configures or reports changed fields for this contract. */\n changed_fields: string[];\n /** Value that configures or reports warnings for this contract. */\n warnings: string[];\n}\n\ninterface AutoUnblockCandidate {\n id: string;\n blocker_ids: string[];\n}\n\ntype CloseInlineFieldKey = \"resolution\" | \"expected_result\" | \"actual_result\";\n\ninterface CloseMutationContext {\n statusRegistry: RuntimeStatusRegistry;\n force: boolean | undefined;\n options: CloseCommandOptions;\n duplicateOf: string | undefined;\n validateCloseMode: ValidateCloseMode;\n activeChildIds: string[];\n closeReason: string | undefined;\n closedAt: string;\n}\n\nfunction toAuthor(\n candidate: string | undefined,\n defaultAuthor: string,\n): string {\n const resolved = candidate ?? process.env.PM_AUTHOR ?? defaultAuthor;\n const trimmed = resolved.trim();\n return trimmed || \"unknown\";\n}\n\nfunction normalizeCloseReason(\n reasonText: string | undefined,\n required: boolean,\n): string | undefined {\n const reason = (reasonText ?? \"\").trim();\n if (reason.length > 0) {\n return reason;\n }\n if (required) {\n throw new PmCliError(\n \"Close reason text is required because governance.require_close_reason is enabled\",\n EXIT_CODE.USAGE,\n {\n code: \"close_reason_required\",\n required:\n \"Provide a one-line closing summary as the positional text, --reason, or --message.\",\n why: \"governance.require_close_reason is enabled, so every close must record why the item is done.\",\n examples: [\n 'pm close <id> \"Done: <what changed and why>\"',\n 'pm close <id> --reason \"<closing summary>\"',\n 'pm close <id> -m \"<closing summary>\"',\n \"pm close <id> --duplicate-of <canonical-id>\",\n ],\n nextSteps: [\n \"Re-run the close with a closing summary.\",\n 'When closing as a duplicate, --duplicate-of <id> auto-fills the close reason as \"Duplicate of <id>\".',\n \"To stop requiring reasons, run: pm config set governance-require-close-reason --policy disabled\",\n ],\n },\n );\n }\n return undefined;\n}\n\ntype ValidateCloseMode = \"off\" | \"warn\" | \"strict\";\n\ninterface CloseReasonFallbackInput {\n closeReasonText: string | undefined;\n duplicateOf: string | undefined;\n resolution: string | undefined;\n message: string | undefined;\n requireCloseReason: boolean;\n}\n\nfunction resolveEffectiveCloseReasonText(\n input: CloseReasonFallbackInput,\n): string | undefined {\n if ((input.closeReasonText ?? \"\").trim().length > 0) {\n return input.closeReasonText;\n }\n if (input.duplicateOf !== undefined) {\n return `Duplicate of ${input.duplicateOf}`;\n }\n const trimmedResolution =\n typeof input.resolution === \"string\" ? input.resolution.trim() : \"\";\n if (trimmedResolution.length > 0) {\n return trimmedResolution;\n }\n const trimmedMessage =\n typeof input.message === \"string\" ? input.message.trim() : \"\";\n if (input.requireCloseReason && trimmedMessage.length > 0) {\n return trimmedMessage;\n }\n return input.closeReasonText;\n}\n\nconst CLOSE_VALIDATION_FIELDS: Array<{\n key: keyof Pick<\n ItemMetadata,\n \"resolution\" | \"expected_result\" | \"actual_result\"\n >;\n label: string;\n}> = [\n { key: \"resolution\", label: \"resolution\" },\n { key: \"expected_result\", label: \"expected_result\" },\n { key: \"actual_result\", label: \"actual_result\" },\n];\n\nfunction parseValidateCloseMode(\n raw: string | undefined,\n): ValidateCloseMode | undefined {\n if (raw === undefined) {\n return undefined;\n }\n const normalized = raw.trim().toLowerCase();\n if (normalized.length === 0 || normalized === \"warn\") {\n return \"warn\";\n }\n if (\n normalized === \"off\" ||\n normalized === \"none\" ||\n normalized === \"disabled\"\n ) {\n return \"off\";\n }\n if (normalized === \"strict\") {\n return \"strict\";\n }\n throw new PmCliError(\n `Invalid --validate-close mode \"${raw}\" (expected \"off\", \"warn\", or \"strict\")`,\n EXIT_CODE.USAGE,\n );\n}\n\nfunction findMissingCloseValidationFields(\n itemMetadata: ItemMetadata,\n): string[] {\n const missing: string[] = [];\n for (const field of CLOSE_VALIDATION_FIELDS) {\n const rawValue = itemMetadata[field.key];\n if (typeof rawValue !== \"string\" || rawValue.trim().length === 0) {\n missing.push(field.label);\n }\n }\n return missing;\n}\n\nasync function duplicateChainReferencesClosingItem(\n loadItemById: (id: string) => Promise<ItemMetadata | null>,\n initialDuplicateOf: unknown,\n closingId: string,\n): Promise<boolean> {\n const visited = new Set<string>();\n let current = initialDuplicateOf;\n while (typeof current === \"string\" && current.trim().length > 0) {\n const currentId = current.trim();\n if (currentId === closingId) {\n return true;\n }\n if (visited.has(currentId)) {\n return false;\n }\n visited.add(currentId);\n current = (await loadItemById(currentId))?.duplicate_of;\n }\n return false;\n}\n\nfunction shouldApplyDuplicateFallback(value: unknown): boolean {\n return typeof value !== \"string\" || value.trim().length === 0;\n}\n\nasync function assertDuplicateTargetExists(\n pmRoot: string,\n settings: Awaited<ReturnType<typeof readSettings>>,\n duplicateOf: string | undefined,\n closingId: string,\n): Promise<string | undefined> {\n const rawTarget = duplicateOf?.trim();\n if (!rawTarget) {\n return undefined;\n }\n if (rawTarget === closingId) {\n throw new PmCliError(\n \"An item cannot be closed as a duplicate of itself.\",\n EXIT_CODE.USAGE,\n {\n code: \"duplicate_target_self\",\n why: \"--duplicate-of must identify the canonical item that should remain open or already represent the work.\",\n },\n );\n }\n const typeRegistry = resolveItemTypeRegistry(settings);\n const itemCache = new Map<string, ItemMetadata | null>();\n const loadItemById = async (id: string): Promise<ItemMetadata | null> => {\n if (itemCache.has(id)) {\n return itemCache.get(id) ?? null;\n }\n const located = await locateItem(\n pmRoot,\n id,\n settings.id_prefix,\n settings.item_format,\n typeRegistry.type_to_folder,\n );\n if (!located) {\n itemCache.set(id, null);\n return null;\n }\n const { document } = await readLocatedItem(located, {\n schema: settings.schema,\n });\n itemCache.set(id, document.metadata);\n return document.metadata;\n };\n const target = await loadItemById(rawTarget);\n if (!target) {\n throw new PmCliError(\n `Duplicate target \"${rawTarget}\" was not found. Create or locate the canonical item first.`,\n EXIT_CODE.USAGE,\n {\n code: \"duplicate_target_missing\",\n why: \"Duplicate closure should point at a real canonical pm item so future dedupe and changelog tooling can trace the relationship.\",\n examples: [\n `pm close ${closingId} \"Duplicate of ${rawTarget}\" --duplicate-of ${rawTarget}`,\n ],\n nextSteps: [\n \"Run pm search/list to find the canonical item, then retry with --duplicate-of <id>.\",\n ],\n },\n );\n }\n if (\n await duplicateChainReferencesClosingItem(\n loadItemById,\n target.duplicate_of,\n closingId,\n )\n ) {\n throw new PmCliError(\n `Circular duplicate reference detected. Target \"${rawTarget}\" points back to \"${closingId}\".`,\n EXIT_CODE.USAGE,\n {\n code: \"duplicate_target_circular\",\n why: \"Circular duplicate relationships create loops for dedupe and status propagation tooling.\",\n nextSteps: [\n \"Choose the existing canonical item, or clear the target duplicate_of metadata before closing this item as a duplicate.\",\n ],\n },\n );\n }\n if (\n typeof target.duplicate_of === \"string\" &&\n target.duplicate_of.trim().length > 0\n ) {\n throw new PmCliError(\n `Duplicate target \"${rawTarget}\" is already marked as a duplicate of \"${target.duplicate_of.trim()}\".`,\n EXIT_CODE.USAGE,\n {\n code: \"duplicate_target_is_duplicate\",\n why: \"Duplicate closure should point directly at the canonical item, not another duplicate.\",\n examples: [\n `pm close ${closingId} \"Duplicate of ${target.duplicate_of.trim()}\" --duplicate-of ${target.duplicate_of.trim()}`,\n ],\n nextSteps: [\n \"Use the canonical item referenced by duplicate_of as the --duplicate-of target.\",\n ],\n },\n );\n }\n return target.id;\n}\n\nasync function findActiveChildIds(\n pmRoot: string,\n settings: Awaited<ReturnType<typeof readSettings>>,\n parentId: string,\n statusRegistry: RuntimeStatusRegistry,\n): Promise<string[]> {\n const typeRegistry = resolveItemTypeRegistry(settings);\n const items = await listAllItemMetadataLight(\n pmRoot,\n settings.item_format,\n typeRegistry.type_to_folder,\n undefined,\n settings.schema,\n );\n return items\n .filter(\n (item) =>\n item.parent === parentId &&\n !isTerminalStatus(item.status, statusRegistry),\n )\n .map((item) => item.id)\n .sort((left, right) => left.localeCompare(right));\n}\n\nasync function findAutoUnblockCandidates(\n pmRoot: string,\n settings: Awaited<ReturnType<typeof readSettings>>,\n closedId: string,\n statusRegistry: RuntimeStatusRegistry,\n): Promise<AutoUnblockCandidate[]> {\n const typeRegistry = resolveItemTypeRegistry(settings);\n const items = await listAllItemMetadataLight(\n pmRoot,\n settings.item_format,\n typeRegistry.type_to_folder,\n undefined,\n settings.schema,\n );\n const itemsById = new Map(items.map((item) => [item.id, item]));\n const blockedStatuses = statusRegistry.blocked_statuses;\n return items\n .filter((item) => blockedStatuses.has(item.status))\n .map((item) => ({ item, blockerIds: collectBlockedByIds(item) }))\n .filter(({ blockerIds }) => blockerIds.includes(closedId))\n .filter(({ blockerIds }) =>\n blockerIds.every((blockerId) => {\n const blocker = itemsById.get(blockerId);\n return (\n blocker !== undefined &&\n isTerminalStatus(blocker.status, statusRegistry)\n );\n }),\n )\n .map(({ item, blockerIds }) => ({ id: item.id, blocker_ids: blockerIds }))\n .sort((left, right) => left.id.localeCompare(right.id));\n}\n\nasync function autoUnblockResolvedDependents(\n pmRoot: string,\n settings: Awaited<ReturnType<typeof readSettings>>,\n closedId: string,\n author: string,\n statusRegistry: RuntimeStatusRegistry,\n): Promise<string[]> {\n const candidates = await findAutoUnblockCandidates(\n pmRoot,\n settings,\n closedId,\n statusRegistry,\n );\n const warnings: string[] = [];\n for (const candidate of candidates) {\n try {\n const unblocked = await mutateItem({\n pmRoot,\n settings,\n id: candidate.id,\n op: \"update\",\n author,\n message: `Auto-unblocked after blocker ${closedId} closed`,\n mutate(document) {\n /* c8 ignore start -- normal auto-unblock candidates carry dependency metadata; fallback preserves hand-edited scalar-only blockers. */\n const dependencies = document.metadata.dependencies ?? [];\n /* c8 ignore stop */\n const remainingDependencies = dependencies.filter((dependency) => {\n const dependencyId = dependency.id.trim();\n return (\n dependency.kind !== \"blocked_by\" ||\n !candidate.blocker_ids.includes(dependencyId)\n );\n });\n document.metadata.status = statusRegistry.open_status;\n delete document.metadata.blocked_by;\n delete document.metadata.blocked_reason;\n document.metadata.unblock_note = `Auto-unblocked after blocker ${closedId} closed; all blockers resolved (${candidate.blocker_ids.join(\", \")}).`;\n if (remainingDependencies.length > 0) {\n document.metadata.dependencies = remainingDependencies;\n } else {\n delete document.metadata.dependencies;\n }\n const changedFields = [\n \"status\",\n \"blocked_by\",\n \"blocked_reason\",\n \"unblock_note\",\n ];\n if (remainingDependencies.length !== dependencies.length) {\n changedFields.push(\"dependencies\");\n }\n return {\n changedFields,\n };\n },\n });\n warnings.push(\n `auto_unblocked:${unblocked.item.id}:resolved_blockers=${candidate.blocker_ids.join(\",\")}`,\n );\n /* c8 ignore start -- defensive fan-out failure path; normal lock/claim state is auditable and still unblocks. */\n } catch (error) {\n const reason =\n error instanceof Error\n ? error.message.replace(/\\s+/g, \" \").trim()\n : \"unknown\";\n warnings.push(`auto_unblock_failed:${candidate.id}:${reason}`);\n }\n /* c8 ignore stop */\n }\n return warnings;\n}\n\nfunction applyInlineCloseFields(\n metadata: ItemMetadata,\n options: CloseCommandOptions,\n): CloseInlineFieldKey[] {\n const changedFields: CloseInlineFieldKey[] = [];\n const inlineCloseFields: Array<{\n option: string | undefined;\n key: CloseInlineFieldKey;\n }> = [\n { option: options.resolution, key: \"resolution\" },\n { option: options.expectedResult, key: \"expected_result\" },\n { option: options.actualResult, key: \"actual_result\" },\n ];\n for (const { option, key } of inlineCloseFields) {\n if (typeof option !== \"string\") {\n continue;\n }\n const trimmed = option.trim();\n if (trimmed.length === 0) {\n continue;\n }\n metadata[key] = trimmed;\n changedFields.push(key);\n }\n return changedFields;\n}\n\nfunction applyDuplicateCloseMetadata(\n metadata: ItemMetadata,\n duplicateOf: string | undefined,\n): CloseInlineFieldKey[] {\n if (duplicateOf === undefined) {\n return [];\n }\n metadata.duplicate_of = duplicateOf;\n const duplicateFallbackFields: CloseInlineFieldKey[] = [];\n const fallbackValues: Array<{ key: CloseInlineFieldKey; value: string }> = [\n { key: \"resolution\", value: `Duplicate of ${duplicateOf}` },\n {\n key: \"expected_result\",\n value: `Canonical item ${duplicateOf} tracks the work.`,\n },\n { key: \"actual_result\", value: `Closed as duplicate of ${duplicateOf}.` },\n ];\n for (const { key, value } of fallbackValues) {\n if (shouldApplyDuplicateFallback(metadata[key])) {\n metadata[key] = value;\n duplicateFallbackFields.push(key);\n }\n }\n return duplicateFallbackFields;\n}\n\nfunction collectCloseValidationWarnings(\n metadata: ItemMetadata,\n validateCloseMode: ValidateCloseMode,\n activeChildIds: string[],\n): string[] {\n const warnings: string[] = [];\n if (validateCloseMode !== \"off\") {\n const missingFields = findMissingCloseValidationFields(metadata);\n if (missingFields.length > 0) {\n if (validateCloseMode === \"strict\") {\n throw new PmCliError(\n `Cannot close item ${metadata.id}: missing ${missingFields.join(\", \")}. Populate fields or use --validate-close warn.`,\n EXIT_CODE.USAGE,\n );\n }\n warnings.push(\n `close_validation_missing_fields:${metadata.id}:${missingFields.join(\",\")}`,\n );\n }\n if (activeChildIds.length > 0) {\n if (validateCloseMode === \"strict\") {\n throw new PmCliError(\n `Cannot close item ${metadata.id}: active child items remain open (${activeChildIds.join(\", \")}). Close, cancel, or re-parent them first, or use --validate-close warn.`,\n EXIT_CODE.USAGE,\n );\n }\n warnings.push(\n `close_validation_active_children:${metadata.id}:${activeChildIds.join(\",\")}`,\n );\n }\n return warnings;\n }\n if (activeChildIds.length > 0) {\n warnings.push(\n `closed_with_active_children:${metadata.id}:${activeChildIds.join(\",\")}`,\n );\n }\n return warnings;\n}\n\nfunction applyCloseReason(\n metadata: ItemMetadata,\n closeReason: string | undefined,\n): string[] {\n if (closeReason !== undefined) {\n metadata.close_reason = closeReason;\n return [\"close_reason\"];\n }\n if (metadata.close_reason !== undefined) {\n delete metadata.close_reason;\n return [\"close_reason\"];\n }\n return [];\n}\n\nfunction clearCloseAssignee(metadata: ItemMetadata): string[] {\n if (metadata.assignee === undefined) {\n return [];\n }\n delete metadata.assignee;\n return [\"assignee\"];\n}\n\nfunction clearClosedBlockerSignals(metadata: ItemMetadata): {\n changedFields: string[];\n warnings: string[];\n} {\n const previousBlockedBy =\n typeof metadata.blocked_by === \"string\" ? metadata.blocked_by.trim() : \"\";\n const existingDeps = metadata.dependencies ?? [];\n const blockedByEdge = existingDeps.find((dep) => dep.kind === \"blocked_by\");\n const hadBlockedReason = metadata.blocked_reason !== undefined;\n if (\n previousBlockedBy.length === 0 &&\n blockedByEdge === undefined &&\n !hadBlockedReason\n ) {\n return { changedFields: [], warnings: [] };\n }\n const changedFields: string[] = [];\n if (previousBlockedBy.length > 0) {\n delete metadata.blocked_by;\n changedFields.push(\"blocked_by\");\n }\n if (hadBlockedReason) {\n delete metadata.blocked_reason;\n changedFields.push(\"blocked_reason\");\n }\n if (blockedByEdge !== undefined) {\n const remainingDeps = existingDeps.filter(\n (dep) => dep.kind !== \"blocked_by\",\n );\n if (remainingDeps.length > 0) {\n metadata.dependencies = remainingDeps;\n } else {\n delete metadata.dependencies;\n }\n changedFields.push(\"dependencies\");\n }\n // A stale reason-only close has no blocker identity; omit the blocker-clear warning instead of inventing one.\n const reportedBlocker = previousBlockedBy || blockedByEdge?.id;\n return {\n changedFields,\n warnings: reportedBlocker\n ? [`closed_cleared_blocked_by:${metadata.id}:${reportedBlocker}`]\n : [],\n };\n}\n\nfunction mutateCloseMetadata(\n metadata: ItemMetadata,\n context: CloseMutationContext,\n): { changedFields: string[]; warnings?: string[] } {\n if (\n isTerminalStatus(metadata.status, context.statusRegistry) &&\n !context.force\n ) {\n throw new PmCliError(\n `Item ${metadata.id} is already terminal; use --force to close again.`,\n EXIT_CODE.CONFLICT,\n );\n }\n const inlineChangedFields = applyInlineCloseFields(metadata, context.options);\n const duplicateFallbackFields = applyDuplicateCloseMetadata(\n metadata,\n context.duplicateOf,\n );\n const mutationWarnings = collectCloseValidationWarnings(\n metadata,\n context.validateCloseMode,\n context.activeChildIds,\n );\n metadata.status = context.statusRegistry.close_status;\n metadata.closed_at = context.closedAt;\n const changedFields = [\n \"status\",\n \"closed_at\",\n ...applyCloseReason(metadata, context.closeReason),\n ...inlineChangedFields,\n ];\n if (context.duplicateOf !== undefined) {\n changedFields.push(\"duplicate_of\");\n for (const key of duplicateFallbackFields) {\n /* v8 ignore start -- duplicate fallback keys are already pre-deduped by applyDuplicateCloseMetadata in covered close paths */\n if (!changedFields.includes(key)) {\n changedFields.push(key);\n }\n /* v8 ignore stop */\n }\n }\n changedFields.push(...clearCloseAssignee(metadata));\n const blockerCleanup = clearClosedBlockerSignals(metadata);\n changedFields.push(...blockerCleanup.changedFields);\n mutationWarnings.push(...blockerCleanup.warnings);\n return {\n changedFields,\n ...(mutationWarnings.length > 0 ? { warnings: mutationWarnings } : {}),\n };\n}\n\n/** Public contract for test only close command, shared by SDK and presentation-layer consumers. */\nexport const _testOnlyCloseCommand = {\n blockedByIds: collectBlockedByIds,\n};\n\n/** Implements run close for the public runtime surface of this module. */\nexport async function runClose(\n id: string,\n closeReasonText: string | undefined,\n options: CloseCommandOptions,\n global: GlobalOptions,\n): Promise<CloseResult> {\n const pmRoot = resolvePmRoot(process.cwd(), global.path);\n if (!(await pathExists(getSettingsPath(pmRoot)))) {\n throw new PmCliError(\n `Tracker is not initialized at ${pmRoot}. Run pm init first.`,\n EXIT_CODE.NOT_FOUND,\n );\n }\n\n const settings = await readSettings(pmRoot);\n const statusRegistry = resolveRuntimeStatusRegistry(settings.schema);\n const author = toAuthor(options.author, settings.author_default);\n // GH-250: verify the target item EXISTS before the governance close-reason\n // gate fires. Otherwise closing a typo'd id with no reason reports\n // \"Close reason text is required\" and hides the real cause (bad id) until a\n // reason is supplied. Existence is the more fundamental precondition, so it\n // is validated first regardless of whether a reason was provided.\n const typeToFolder = resolveItemTypeRegistry(settings).type_to_folder;\n const located = await locateItem(\n pmRoot,\n id,\n settings.id_prefix,\n settings.item_format,\n typeToFolder,\n );\n if (!located) {\n throw await buildItemNotFoundError(\n pmRoot,\n id,\n settings.id_prefix,\n typeToFolder,\n );\n }\n // GH-204: resolve the duplicate target BEFORE reason validation so\n // `pm close <id> --duplicate-of <canonical>` succeeds under\n // governance.require_close_reason without a manual reason — when no\n // positional/--reason text is provided the reason defaults to\n // \"Duplicate of <id>\" (mirroring the auto-filled closure metadata).\n // Explicit reason text still wins.\n const duplicateOf = await assertDuplicateTargetExists(\n pmRoot,\n settings,\n options.duplicateOf,\n id,\n );\n // pm-7x8d / pm-9hry / GH-204: when no explicit positional/--reason text is given, derive\n // the close reason from the next-best closure signal instead of hard-blocking\n // under governance.require_close_reason. Precedence: explicit reason text >\n // --duplicate-of (\"Duplicate of <id>\") > --resolution summary > --message.\n // Resolution still writes metadata.resolution below; message still writes the\n // history entry through mutateItem. Reusing either as the close reason just lets\n // a single agent-authored close command succeed when it already supplied a\n // closure summary through another structured option.\n const effectiveCloseReasonText = resolveEffectiveCloseReasonText({\n closeReasonText,\n duplicateOf,\n resolution: options.resolution,\n message: options.message,\n requireCloseReason: settings.governance.require_close_reason,\n });\n const closeReason = normalizeCloseReason(\n effectiveCloseReasonText,\n settings.governance.require_close_reason,\n );\n const validateCloseMode =\n parseValidateCloseMode(options.validateClose) ??\n settings.governance.close_validation_default;\n // C3 (pm-fu5d): scan for active children even under minimal governance so\n // closing a parent is never silently orphaning — off mode emits an\n // informational note instead of the warn/strict validation warning.\n const activeChildIds = await findActiveChildIds(\n pmRoot,\n settings,\n id,\n statusRegistry,\n );\n\n const result = await mutateItem({\n pmRoot,\n settings,\n id,\n op: \"close\",\n author,\n message: options.message,\n force: options.force,\n mutate(document) {\n return mutateCloseMetadata(document.metadata, {\n statusRegistry,\n force: options.force,\n options,\n duplicateOf,\n validateCloseMode,\n activeChildIds,\n closeReason,\n closedAt: new Date().toISOString(),\n });\n },\n });\n\n return {\n item: toItemRecord(result.item),\n changed_fields: result.changedFields,\n warnings: [\n ...result.warnings,\n ...(await autoUnblockResolvedDependents(\n pmRoot,\n settings,\n located.id,\n author,\n statusRegistry,\n )),\n ],\n };\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