@unbrained/pm-cli 2026.11.5 → 2026.11.7

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 (349) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +20 -0
  3. package/dist/cli/expected-revisions.js +1 -1
  4. package/dist/cli/main.js +1 -1
  5. package/dist/cli/register-operations.js +1 -1
  6. package/dist/cli/runtime/close-fields-retry.js +2 -0
  7. package/dist/cli-bundle/bundle-manifest.json +1 -1
  8. package/dist/cli-bundle/chunks/chunk-3DI6CEF3.js +3 -0
  9. package/dist/cli-bundle/chunks/{chunk-6VRX2CM7.js → chunk-4PPWVIIT.js} +2 -2
  10. package/dist/cli-bundle/chunks/{chunk-7ZRCYESH.js → chunk-5KHLV7JU.js} +47 -47
  11. package/dist/cli-bundle/chunks/{chunk-JI2GDE4I.js → chunk-BQ5O3CBF.js} +51 -51
  12. package/dist/cli-bundle/chunks/{chunk-F6NDMKZ4.js → chunk-COKKWMSC.js} +2 -2
  13. package/dist/cli-bundle/chunks/chunk-D53G3NOE.js +6 -0
  14. package/dist/cli-bundle/chunks/{chunk-LS3GI3H4.js → chunk-ETHAZC3F.js} +2 -2
  15. package/dist/cli-bundle/chunks/chunk-F3B2ULHB.js +122 -0
  16. package/dist/cli-bundle/chunks/chunk-JZWFZH2K.js +2 -0
  17. package/dist/cli-bundle/chunks/{chunk-335BZ75D.js → chunk-KPAVZILX.js} +2 -2
  18. package/dist/cli-bundle/chunks/{chunk-OH6WQ7VT.js → chunk-MQOZNGPS.js} +2 -2
  19. package/dist/cli-bundle/chunks/chunk-O6TIOKCM.js +9 -0
  20. package/dist/cli-bundle/chunks/{chunk-XLSHFYXZ.js → chunk-OIBSKKCO.js} +2 -2
  21. package/dist/cli-bundle/chunks/{chunk-HRFGFIYU.js → chunk-OJZG7Y6S.js} +2 -2
  22. package/dist/cli-bundle/chunks/{chunk-HRCMORE7.js → chunk-QG6FLDM4.js} +2 -2
  23. package/dist/cli-bundle/chunks/{chunk-D7KYPRK4.js → chunk-RFI4O6NU.js} +2 -2
  24. package/dist/cli-bundle/chunks/{chunk-OJDMJT7Y.js → chunk-TGQPCNAD.js} +2 -2
  25. package/dist/cli-bundle/chunks/{chunk-DAX3AOFI.js → chunk-VM6OGNQC.js} +2 -2
  26. package/dist/cli-bundle/chunks/{chunk-S4LPZ4TN.js → chunk-WS2N4TQW.js} +7 -7
  27. package/dist/cli-bundle/chunks/{chunk-UEGXWXUZ.js → chunk-WXVMPLBY.js} +2 -2
  28. package/dist/cli-bundle/chunks/{chunk-2RPORE7M.js → chunk-WYIDX67P.js} +30 -30
  29. package/dist/cli-bundle/chunks/{chunk-7DEKAXVA.js → chunk-XSEDESNW.js} +2 -2
  30. package/dist/cli-bundle/chunks/item-revision-SPEKTFBB.js +2 -0
  31. package/dist/cli-bundle/chunks/item-transaction-BT55TQXE.js +2 -0
  32. package/dist/cli-bundle/chunks/{mutation-admission-INMM3HHG.js → mutation-admission-LUXUKISJ.js} +2 -2
  33. package/dist/cli-bundle/chunks/{register-list-query-5Y5JKWU5.js → register-list-query-DU4W7VJU.js} +3 -3
  34. package/dist/cli-bundle/chunks/{register-mutation-WC7OSQID.js → register-mutation-IC2C53QK.js} +2 -2
  35. package/dist/cli-bundle/chunks/register-operations-AHDWE2G3.js +2 -0
  36. package/dist/cli-bundle/chunks/{register-setup-RRFOS7IT.js → register-setup-7BGG3CI3.js} +2 -2
  37. package/dist/cli-bundle/chunks/{stage-E3MMV4TV.js → stage-S5BYWLGY.js} +2 -2
  38. package/dist/cli-bundle/focused-chunks/{chunk-CPMSL4HS.js → chunk-4EXRRSDS.js} +2 -2
  39. package/dist/cli-bundle/focused-chunks/chunk-4LDOL6U7.js +26 -0
  40. package/dist/cli-bundle/focused-chunks/chunk-A46YSPRF.js +2 -0
  41. package/dist/cli-bundle/focused-chunks/{chunk-RFTJZ5VB.js → chunk-AI2PYNFI.js} +2 -2
  42. package/dist/cli-bundle/focused-chunks/chunk-AJ2I377F.js +44 -0
  43. package/dist/cli-bundle/focused-chunks/{chunk-NQ7GYFOX.js → chunk-BIDF4KO7.js} +5 -5
  44. package/dist/cli-bundle/focused-chunks/{chunk-VWWTIX5L.js → chunk-CWFNQQZE.js} +2 -2
  45. package/dist/cli-bundle/focused-chunks/chunk-D3U7FOZR.js +2 -0
  46. package/dist/cli-bundle/focused-chunks/{chunk-F62XGAAY.js → chunk-G2VIY6XA.js} +2 -2
  47. package/dist/cli-bundle/focused-chunks/{chunk-MG7C3JUY.js → chunk-GFF6BITP.js} +2 -2
  48. package/dist/cli-bundle/focused-chunks/{chunk-LW64TINU.js → chunk-IIBWXNW3.js} +2 -2
  49. package/dist/cli-bundle/focused-chunks/{chunk-AHWJPZSJ.js → chunk-IYJRFJHT.js} +2 -2
  50. package/dist/cli-bundle/focused-chunks/{chunk-D2TBEBNW.js → chunk-J5N42SKC.js} +2 -2
  51. package/dist/cli-bundle/focused-chunks/{chunk-MC7IE7D7.js → chunk-JRJOFMI7.js} +2 -2
  52. package/dist/cli-bundle/focused-chunks/{chunk-CZM75DE3.js → chunk-KL33JMPC.js} +2 -2
  53. package/dist/cli-bundle/focused-chunks/{chunk-E56OXRYH.js → chunk-LH4C7BLB.js} +2 -2
  54. package/dist/cli-bundle/focused-chunks/{chunk-YMGB2O4E.js → chunk-LTQEYE2L.js} +2 -2
  55. package/dist/cli-bundle/focused-chunks/chunk-LTTMERPN.js +12 -0
  56. package/dist/cli-bundle/focused-chunks/{chunk-7KK66ISG.js → chunk-LW4TN5ZM.js} +2 -2
  57. package/dist/cli-bundle/focused-chunks/{chunk-XHOBYCVE.js → chunk-MESFDQ3H.js} +2 -2
  58. package/dist/cli-bundle/focused-chunks/{chunk-G4QP365K.js → chunk-MWTBAI3V.js} +2 -2
  59. package/dist/cli-bundle/focused-chunks/chunk-TWULNB3N.js +2 -0
  60. package/dist/cli-bundle/focused-chunks/{chunk-C6P6HPCX.js → chunk-XAC6NP7U.js} +2 -2
  61. package/dist/cli-bundle/focused-chunks/{chunk-GS3JC5UU.js → chunk-XG3TBYQK.js} +2 -2
  62. package/dist/cli-bundle/focused-chunks/chunk-XMZAFKVP.js +91 -0
  63. package/dist/cli-bundle/focused-chunks/item-revision-ELI6NGMY.js +2 -0
  64. package/dist/cli-bundle/focused-chunks/{item-transaction-AEAYVVHA.js → item-transaction-GUGAUY77.js} +2 -2
  65. package/dist/cli-bundle/focused-chunks/{mutation-admission-4WM7TNHZ.js → mutation-admission-54FI37AA.js} +2 -2
  66. package/dist/cli-bundle/focused-chunks/{stage-WV7QXR4C.js → stage-OHDJ43T2.js} +2 -2
  67. package/dist/cli-bundle/main.js +31 -31
  68. package/dist/cli-bundle/sdk-authoring.js +1 -1
  69. package/dist/cli-bundle/sdk-contracts.js +1 -1
  70. package/dist/cli-bundle/sdk-core.js +1 -1
  71. package/dist/cli-bundle/sdk-governance.js +1 -1
  72. package/dist/cli-bundle/sdk-graph.js +1 -1
  73. package/dist/cli-bundle/sdk-merge.js +57 -57
  74. package/dist/cli-bundle/sdk-query.js +1 -1
  75. package/dist/cli-bundle/sdk-runtime.js +1 -1
  76. package/dist/cli-bundle/sdk-testing.js +1 -1
  77. package/dist/cli-bundle/sdk.js +2 -2
  78. package/dist/core/store/item-mutation-precondition.d.ts +58 -0
  79. package/dist/core/store/item-mutation-precondition.js +1 -1
  80. package/dist/sdk/command-line.d.ts +5 -1
  81. package/dist/sdk/command-line.js +1 -1
  82. package/dist/sdk/governance/health/projection.js +1 -1
  83. package/dist/sdk/governance/health.d.ts +3 -3
  84. package/dist/sdk/governance/health.js +2 -2
  85. package/dist/sdk/lifecycle/close.js +1 -1
  86. package/dist/sdk/lifecycle/item-revision.d.ts +15 -4
  87. package/dist/sdk/lifecycle/item-revision.js +1 -1
  88. package/dist/sdk/output/list-envelope.d.ts +18 -7
  89. package/dist/sdk/output/list-envelope.js +1 -1
  90. package/dist/sdk/output-projection.js +1 -1
  91. package/dist/sdk/public-surface.json +1 -1
  92. package/dist/sdk/query/get.d.ts +16 -6
  93. package/dist/sdk/query/get.js +1 -1
  94. package/dist/sdk/query/search/response.js +1 -1
  95. package/dist/sdk/runtime.js +1 -1
  96. package/docs/CLOSE_EVIDENCE_RECOVERY.md +36 -2
  97. package/docs/COMMANDS.md +10 -1
  98. package/docs/GET_READ_EVIDENCE.md +24 -3
  99. package/docs/OUTPUT_PROJECTION_CONTRACTS.md +7 -0
  100. package/docs/RELEASING.md +41 -6
  101. package/docs/SDK.md +24 -7
  102. package/marketplace.json +1 -1
  103. package/package.json +1 -1
  104. package/packages/pm-beads/package.json +1 -1
  105. package/packages/pm-calendar/package.json +1 -1
  106. package/packages/pm-command-kit/package.json +1 -1
  107. package/packages/pm-digital-twin/package.json +1 -1
  108. package/packages/pm-governance-audit/package.json +1 -1
  109. package/packages/pm-guide-shell/package.json +1 -1
  110. package/packages/pm-kanban/package.json +1 -1
  111. package/packages/pm-lifecycle-hooks/package.json +1 -1
  112. package/packages/pm-linked-test-adapters/package.json +1 -1
  113. package/packages/pm-search-advanced/package.json +1 -1
  114. package/packages/pm-templates/package.json +1 -1
  115. package/packages/pm-todos/package.json +1 -1
  116. package/packages/pm-vcs/package.json +1 -1
  117. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  118. package/plugins/pm-claude/package.json +1 -1
  119. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  120. package/plugins/pm-codex/package.json +1 -1
  121. package/plugins/pm-codex/plugin.json +1 -1
  122. package/runtime-dependencies.json +1 -1
  123. package/dist/cli/after-command-context-usage.d.ts +0 -21
  124. package/dist/cli/argv-utils.d.ts +0 -12
  125. package/dist/cli/bootstrap-args.d.ts +0 -6
  126. package/dist/cli/bundle-integrity.d.ts +0 -49
  127. package/dist/cli/command-namespaces.d.ts +0 -9
  128. package/dist/cli/commander-usage.d.ts +0 -73
  129. package/dist/cli/commands/annotations/comments.d.ts +0 -2
  130. package/dist/cli/commands/annotations/docs.d.ts +0 -6
  131. package/dist/cli/commands/annotations/files.d.ts +0 -6
  132. package/dist/cli/commands/annotations/learnings.d.ts +0 -2
  133. package/dist/cli/commands/annotations/notes.d.ts +0 -2
  134. package/dist/cli/commands/extension/describe.d.ts +0 -2
  135. package/dist/cli/commands/extension/extension.d.ts +0 -6
  136. package/dist/cli/commands/extension/scaffold.d.ts +0 -2
  137. package/dist/cli/commands/extension/shared.d.ts +0 -2
  138. package/dist/cli/commands/governance/gc.d.ts +0 -6
  139. package/dist/cli/commands/governance/health.d.ts +0 -6
  140. package/dist/cli/commands/governance/telemetry.d.ts +0 -6
  141. package/dist/cli/commands/governance/validate.d.ts +0 -9
  142. package/dist/cli/commands/history/activity.d.ts +0 -6
  143. package/dist/cli/commands/history/history-compact.d.ts +0 -7
  144. package/dist/cli/commands/history/history-redact.d.ts +0 -8
  145. package/dist/cli/commands/history/history-repair.d.ts +0 -7
  146. package/dist/cli/commands/history/history.d.ts +0 -2
  147. package/dist/cli/commands/history/restore.d.ts +0 -6
  148. package/dist/cli/commands/lifecycle/append.d.ts +0 -6
  149. package/dist/cli/commands/lifecycle/claim.d.ts +0 -2
  150. package/dist/cli/commands/lifecycle/close-many.d.ts +0 -2
  151. package/dist/cli/commands/lifecycle/close.d.ts +0 -6
  152. package/dist/cli/commands/lifecycle/copy.d.ts +0 -6
  153. package/dist/cli/commands/lifecycle/create.d.ts +0 -10
  154. package/dist/cli/commands/lifecycle/delete.d.ts +0 -6
  155. package/dist/cli/commands/lifecycle/focus.d.ts +0 -6
  156. package/dist/cli/commands/lifecycle/plan.d.ts +0 -9
  157. package/dist/cli/commands/lifecycle/update-many.d.ts +0 -6
  158. package/dist/cli/commands/lifecycle/update.d.ts +0 -10
  159. package/dist/cli/commands/query/aggregate.d.ts +0 -2
  160. package/dist/cli/commands/query/context.d.ts +0 -6
  161. package/dist/cli/commands/query/deps.d.ts +0 -6
  162. package/dist/cli/commands/query/duplicates.d.ts +0 -6
  163. package/dist/cli/commands/query/eval.d.ts +0 -6
  164. package/dist/cli/commands/query/get.d.ts +0 -6
  165. package/dist/cli/commands/query/graph.d.ts +0 -7
  166. package/dist/cli/commands/query/list.d.ts +0 -6
  167. package/dist/cli/commands/query/next.d.ts +0 -6
  168. package/dist/cli/commands/query/search.d.ts +0 -6
  169. package/dist/cli/commands/query/stats.d.ts +0 -6
  170. package/dist/cli/commands/test/test-all.d.ts +0 -6
  171. package/dist/cli/commands/test/test-runs.d.ts +0 -6
  172. package/dist/cli/commands/test/test.d.ts +0 -6
  173. package/dist/cli/commands/workspace/config.d.ts +0 -6
  174. package/dist/cli/commands/workspace/contracts.d.ts +0 -2
  175. package/dist/cli/commands/workspace/init.d.ts +0 -6
  176. package/dist/cli/commands/workspace/merge.d.ts +0 -8
  177. package/dist/cli/commands/workspace/profile.d.ts +0 -6
  178. package/dist/cli/commands/workspace/schema.d.ts +0 -7
  179. package/dist/cli/commands/workspace/upgrade.d.ts +0 -2
  180. package/dist/cli/context-intent-invocation.d.ts +0 -2
  181. package/dist/cli/description-stdin.d.ts +0 -2
  182. package/dist/cli/error-guidance.d.ts +0 -276
  183. package/dist/cli/expected-revisions.d.ts +0 -55
  184. package/dist/cli/extension-command-help.d.ts +0 -137
  185. package/dist/cli/extension-command-options.d.ts +0 -37
  186. package/dist/cli/extension-recovery.d.ts +0 -31
  187. package/dist/cli/help-content.d.ts +0 -57
  188. package/dist/cli/help-json-payload.d.ts +0 -83
  189. package/dist/cli/invocation-profile.d.ts +0 -26
  190. package/dist/cli/main.d.ts +0 -263
  191. package/dist/cli/migration-gates.d.ts +0 -55
  192. package/dist/cli/option-values.d.ts +0 -3
  193. package/dist/cli/preflight-warnings.d.ts +0 -11
  194. package/dist/cli/register-annotations.d.ts +0 -11
  195. package/dist/cli/register-assurance.d.ts +0 -8
  196. package/dist/cli/register-files-lookup.d.ts +0 -9
  197. package/dist/cli/register-history-activity.d.ts +0 -8
  198. package/dist/cli/register-history-author.d.ts +0 -8
  199. package/dist/cli/register-history-maintenance.d.ts +0 -9
  200. package/dist/cli/register-list-query.d.ts +0 -27
  201. package/dist/cli/register-mutation-options.d.ts +0 -10
  202. package/dist/cli/register-mutation.d.ts +0 -16
  203. package/dist/cli/register-operations.d.ts +0 -85
  204. package/dist/cli/register-setup.d.ts +0 -16
  205. package/dist/cli/register-structured-mutation.d.ts +0 -15
  206. package/dist/cli/registration-helpers.d.ts +0 -2
  207. package/dist/cli/runtime/activation.d.ts +0 -51
  208. package/dist/cli/runtime/field-route-retry.d.ts +0 -15
  209. package/dist/cli/runtime/invocation-options.d.ts +0 -43
  210. package/dist/cli/runtime/projection-retry.d.ts +0 -9
  211. package/dist/cli/runtime/selection.d.ts +0 -35
  212. package/dist/cli/runtime/telemetry-outcome.d.ts +0 -20
  213. package/dist/cli/runtime-compatibility-boundary.d.ts +0 -17
  214. package/dist/cli/schema/registration.d.ts +0 -4
  215. package/dist/cli/schema-registration-helpers.d.ts +0 -24
  216. package/dist/cli/search-refresh.d.ts +0 -2
  217. package/dist/cli/stats-analytics-json.d.ts +0 -9
  218. package/dist/cli/telemetry-flush.d.ts +0 -2
  219. package/dist/cli-bundle/chunks/chunk-5GWEY4P6.js +0 -122
  220. package/dist/cli-bundle/chunks/chunk-AUEKTX7V.js +0 -6
  221. package/dist/cli-bundle/chunks/chunk-FRNMQM45.js +0 -2
  222. package/dist/cli-bundle/chunks/chunk-HNGLDMSZ.js +0 -9
  223. package/dist/cli-bundle/chunks/chunk-YKXATU2G.js +0 -3
  224. package/dist/cli-bundle/chunks/item-revision-OJJVPQY7.js +0 -2
  225. package/dist/cli-bundle/chunks/item-transaction-QEPBUCMY.js +0 -2
  226. package/dist/cli-bundle/chunks/register-operations-PO63DBZH.js +0 -2
  227. package/dist/cli-bundle/focused-chunks/chunk-5PMJOJCZ.js +0 -44
  228. package/dist/cli-bundle/focused-chunks/chunk-G5PJCR7R.js +0 -2
  229. package/dist/cli-bundle/focused-chunks/chunk-M6V7UMWL.js +0 -26
  230. package/dist/cli-bundle/focused-chunks/chunk-MK4HV4JO.js +0 -2
  231. package/dist/cli-bundle/focused-chunks/chunk-O7EI33NP.js +0 -91
  232. package/dist/cli-bundle/focused-chunks/chunk-SNOXXRSJ.js +0 -2
  233. package/dist/cli-bundle/focused-chunks/chunk-UPJUTP2V.js +0 -12
  234. package/dist/cli-bundle/focused-chunks/item-revision-CTDO4H3I.js +0 -2
  235. package/dist/cli.d.ts +0 -13
  236. package/dist/core/checkpoint/checkpoint-gc.d.ts +0 -61
  237. package/dist/core/checkpoint/mutation-context.d.ts +0 -10
  238. package/dist/core/diagnostics/remediation.d.ts +0 -52
  239. package/dist/core/extensions/activation-transaction.d.ts +0 -22
  240. package/dist/core/extensions/command-visibility-tier.d.ts +0 -8
  241. package/dist/core/extensions/exporter-output-contract.d.ts +0 -12
  242. package/dist/core/extensions/extension-candidate.d.ts +0 -26
  243. package/dist/core/extensions/extension-runtime-helpers.d.ts +0 -16
  244. package/dist/core/extensions/module-graph-snapshot.d.ts +0 -19
  245. package/dist/core/extensions/preflight-ownership.d.ts +0 -5
  246. package/dist/core/extensions/read-output-contract.d.ts +0 -5
  247. package/dist/core/extensions/reserved-host-flags.d.ts +0 -18
  248. package/dist/core/extensions/service-ownership.d.ts +0 -8
  249. package/dist/core/extensions/version-diagnostics.d.ts +0 -2
  250. package/dist/core/fs/atomic-create.d.ts +0 -7
  251. package/dist/core/fs/index.d.ts +0 -6
  252. package/dist/core/fs/path-utils.d.ts +0 -2
  253. package/dist/core/history/drift-cache.d.ts +0 -4
  254. package/dist/core/history/drift-scan.d.ts +0 -51
  255. package/dist/core/history/index.d.ts +0 -6
  256. package/dist/core/history/tombstone.d.ts +0 -3
  257. package/dist/core/history/version-address.d.ts +0 -13
  258. package/dist/core/item/index.d.ts +0 -9
  259. package/dist/core/item/item-type-definition.d.ts +0 -51
  260. package/dist/core/item/toon-decode.d.ts +0 -25
  261. package/dist/core/lock/index.d.ts +0 -6
  262. package/dist/core/lock/lock-confinement.d.ts +0 -55
  263. package/dist/core/lock/lock-gc.d.ts +0 -93
  264. package/dist/core/output/mutation-projection.d.ts +0 -13
  265. package/dist/core/output/query-summary.d.ts +0 -30
  266. package/dist/core/search/staleness.d.ts +0 -23
  267. package/dist/core/sentry/sensitive-assignments.d.ts +0 -9
  268. package/dist/core/shared/conflict-markers.d.ts +0 -18
  269. package/dist/core/shared/index.d.ts +0 -9
  270. package/dist/core/shared/memo.d.ts +0 -7
  271. package/dist/core/store/index.d.ts +0 -9
  272. package/dist/core/store/settings-concurrency.d.ts +0 -7
  273. package/dist/core/telemetry/read-sampling.d.ts +0 -8
  274. package/dist/core/test/item-test-run-tracking.d.ts +0 -12
  275. package/dist/core/validate/estimate-defaults.d.ts +0 -21
  276. package/dist/core/validate/linked-artifact-reference.d.ts +0 -20
  277. package/dist/mcp/http-server.d.ts +0 -60
  278. package/dist/mcp/legacy-adapter.d.ts +0 -59
  279. package/dist/mcp/runtime-capabilities.d.ts +0 -57
  280. package/dist/mcp/server.d.ts +0 -101
  281. package/dist/sdk/cli-contracts/bootstrap-command-scanner.d.ts +0 -23
  282. package/dist/sdk/cli-contracts/registration-helpers.d.ts +0 -123
  283. package/dist/sdk/cli-contracts/schemas/assurance-definition.d.ts +0 -796
  284. package/dist/sdk/cli-contracts/string-lists.d.ts +0 -9
  285. package/dist/sdk/cli-contracts/tool-parameter-tables.d.ts +0 -35
  286. package/dist/sdk/context/usage-egress.d.ts +0 -9
  287. package/dist/sdk/dependencies/context-budget-recovery.d.ts +0 -21
  288. package/dist/sdk/dependency-flag-validation.d.ts +0 -32
  289. package/dist/sdk/extension/author-manifest.d.ts +0 -22
  290. package/dist/sdk/extension/bundled-catalog.d.ts +0 -35
  291. package/dist/sdk/extension/concurrency.d.ts +0 -7
  292. package/dist/sdk/extension/copy-scope.d.ts +0 -2
  293. package/dist/sdk/extension/custom-field-collisions.d.ts +0 -6
  294. package/dist/sdk/extension/install-receipts.d.ts +0 -7
  295. package/dist/sdk/extension/install-snapshot.d.ts +0 -34
  296. package/dist/sdk/extension/managed-update-status.d.ts +0 -3
  297. package/dist/sdk/extension/runtime-summary.d.ts +0 -9
  298. package/dist/sdk/extension/scaffold.d.ts +0 -38
  299. package/dist/sdk/generated/error-code-catalog-rows.d.ts +0 -39
  300. package/dist/sdk/generated/generated-error-code-catalog-part-1.d.ts +0 -8
  301. package/dist/sdk/generated/generated-error-code-catalog-part-2.d.ts +0 -8
  302. package/dist/sdk/governance/assurance-limits.d.ts +0 -7
  303. package/dist/sdk/governance/defect-recurrence-signals.d.ts +0 -10
  304. package/dist/sdk/governance/health-merge-evidence.d.ts +0 -23
  305. package/dist/sdk/governance/tracked-runtime-cache.d.ts +0 -24
  306. package/dist/sdk/governance/validate-history-drift.d.ts +0 -7
  307. package/dist/sdk/history/attestation-scan.d.ts +0 -16
  308. package/dist/sdk/history-mcp.d.ts +0 -17
  309. package/dist/sdk/lifecycle/checkpoint-rollback.d.ts +0 -15
  310. package/dist/sdk/lifecycle/core-field-recovery.d.ts +0 -33
  311. package/dist/sdk/lifecycle/core-item-fields.d.ts +0 -6
  312. package/dist/sdk/lifecycle/event-validation-messages.d.ts +0 -6
  313. package/dist/sdk/lifecycle/hierarchy-mutation-lock.d.ts +0 -15
  314. package/dist/sdk/lifecycle/legacy-none-tokens.d.ts +0 -71
  315. package/dist/sdk/lifecycle/mcp-actions.d.ts +0 -24
  316. package/dist/sdk/lifecycle/metadata-normalizers.d.ts +0 -8
  317. package/dist/sdk/lifecycle/mutation-facet-contracts.d.ts +0 -6
  318. package/dist/sdk/lifecycle/mutation-option-validation.d.ts +0 -2
  319. package/dist/sdk/lifecycle/recurrence-parsers.d.ts +0 -34
  320. package/dist/sdk/lifecycle/release-handoff.d.ts +0 -12
  321. package/dist/sdk/lifecycle/repeatable-metadata-parsers.d.ts +0 -18
  322. package/dist/sdk/lifecycle/repeated-terminal-state.d.ts +0 -45
  323. package/dist/sdk/merge/abandoned-receipts.d.ts +0 -15
  324. package/dist/sdk/merge/history-scalar-rebase.d.ts +0 -9
  325. package/dist/sdk/merge/ignored-artifacts.d.ts +0 -13
  326. package/dist/sdk/merge/indexed-receipt-blobs.d.ts +0 -4
  327. package/dist/sdk/merge/receipt-file-boundary.d.ts +0 -23
  328. package/dist/sdk/merge/settlement-hook.d.ts +0 -12
  329. package/dist/sdk/merge/stage.d.ts +0 -13
  330. package/dist/sdk/merge/worktree-config.d.ts +0 -11
  331. package/dist/sdk/query/light-metadata.d.ts +0 -3
  332. package/dist/sdk/query/window-pagination.d.ts +0 -20
  333. package/dist/sdk/read-output/extension.d.ts +0 -7
  334. package/dist/sdk/read-output/provenance.d.ts +0 -20
  335. package/dist/sdk/read-output/surfaces.d.ts +0 -27
  336. package/dist/sdk/runtime/actions.d.ts +0 -4
  337. package/dist/sdk/runtime/mutation-admission.d.ts +0 -2
  338. package/dist/sdk/runtime/mutation-value-validation.d.ts +0 -16
  339. package/dist/sdk/runtime/schema.d.ts +0 -4
  340. package/dist/sdk/runtime-action-aliases.d.ts +0 -7
  341. package/dist/sdk/runtime-extended-actions.d.ts +0 -27
  342. package/dist/sdk/runtime-stats-options.d.ts +0 -9
  343. package/dist/sdk/test/command-args.d.ts +0 -4
  344. package/dist/sdk/test/command-resolution.d.ts +0 -5
  345. package/dist/sdk/test/entry.d.ts +0 -18
  346. package/dist/sdk/test/execution-receipts.d.ts +0 -34
  347. package/dist/sdk/test/receipt-index-snapshot.d.ts +0 -2
  348. package/dist/sdk/test/workspace-snapshot.d.ts +0 -11
  349. package/dist/sdk/traceability/runtime-files-lookup.d.ts +0 -8
@@ -53,14 +53,24 @@ item:GetItemProjection;
53
53
  * Omitted for historical `--at` reads.
54
54
  */
55
55
  item_hash?:string;
56
- /** Requested artifact groups; narrower selectors leave unrequested groups empty. */
56
+ /**
57
+ * Requested artifact groups. Depth reads and the whole `linked` selector carry
58
+ * all three groups; `linked.files`, `linked.tests` and `linked.docs` carry only
59
+ * the selected groups, so a present empty array always means the group is empty
60
+ * (GH-1663). Populated groups a nested selector left out are named by the
61
+ * omission receipt as `linked.<group>`.
62
+ */
57
63
  linked?:{
58
- files:LinkedFile[];
59
- tests:LinkedTest[];
60
- docs:LinkedDoc[];
64
+ files?:LinkedFile[];
65
+ tests?:LinkedTest[];
66
+ docs?:LinkedDoc[];
61
67
  };
62
- /** Ownership evidence for the current or selected historical snapshot. */
63
- claim_state?:ClaimStateContext;
68
+ /**
69
+ * Ownership evidence for the current or selected historical snapshot. Depth
70
+ * reads and the whole `claim_state` selector carry every member; a
71
+ * `claim_state.<member>` selector carries only the selected members (GH-1663).
72
+ */
73
+ claim_state?:Partial<ClaimStateContext>;
64
74
  /** Current child rollup for full or explicit child reads and deep container reads; historical hierarchy is not indexed. */
65
75
  children?:ChildRollupContext;
66
76
  /** Normalized scheduling data for scheduled item types and metadata. */
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="97bd0220-e19e-5466-b989-5e0f95c8b937")}catch{}})();import{collectRegisteredItemFieldNames}from"../../core/extensions/item-fields.js";import{assertInitializedTracker}from"../environment/tracker-preflight.js";import{getActiveExtensionRegistrations,toItemRecord,resolveItemTypeRegistry,resolveRuntimeFieldRegistry,resolveRuntimeStatusRegistry,EXIT_CODE,TYPE_TO_FOLDER,PmCliError,buildItemNotFoundError,listAllItemMetadataLight,locateItem,readLocatedItem,getHistoryPath,resolvePmRoot,readSettings,resolveAuthor}from"../runtime-primitives.js";import{readHistoryEntries}from"../history-read.js";import{hashDocument}from"../../core/history/history.js";import{renderPmCommand}from"../command-line.js";import{recordContextUsageTouches}from"../context-usage.js";import{collectBlockedByIds}from"../actionability.js";import{resolveDeclaredBlockers}from"./declared-blockers.js";import{buildItemChildrenRollup}from"../item-children.js";import{buildItemSchedule}from"../item-schedule.js";import{getItemAt}from"../history-read.js";import{parseIntegerLimit}from"./parsers.js";import{runList}from"./list.js";import{registerOutputMaterialFieldGroups}from"../output-projection.js";import{GET_DEPTH_INPUT_VALUES,GET_DEPTH_VALUES,listGetProjectionFields}from"./projection-contracts.js";import{GET_DEPTH_INPUT_VALUES as GET_DEPTH_INPUT_VALUES2,GET_DEPTH_VALUES as GET_DEPTH_VALUES2,listGetProjectionFields as listGetProjectionFields2}from"./projection-contracts.js";const AUTOMATIC_CHILD_ROLLUP_TYPES=new Set(["epic","feature","milestone","plan"]),BUILTIN_ITEM_TYPES=new Set(Object.keys(TYPE_TO_FOLDER).map(type=>type.toLowerCase()));function itemCollectionCounts(item){return Object.fromEntries(["comments","notes","learnings","files","tests","docs","reminders","events"].map(key=>[key,item[key]?.length??0]))}function itemMaterialFieldGroups(item,body,children,currentSnapshot,projection){const collectionCounts=itemCollectionCounts(item);return[...body.length>0?["body"]:[],...Object.entries(collectionCounts).flatMap(([name,count])=>count>0?[name]:[]),...collectionCounts.files+collectionCounts.tests+collectionCounts.docs>0?["linked"]:[],...children===void 0?["children"]:children.count>0?["children"]:[],...typeof item.assignee=="string"&&item.assignee.trim().length>0?["claim_state"]:[],...buildItemSchedule(item)?["schedule"]:[],...currentSnapshot&&collectBlockedByIds(item).length>0?["blockers"]:[],...!projection.full&&item.dependencies?.some(({id:_id,kind:_kind,...provenance})=>Object.values(provenance).some(value=>value!==void 0))?["dependency_provenance"]:[]]}function shouldAutoIncludeGetChildren(itemType){const normalizedType=itemType.trim().toLowerCase();return normalizedType.length>0&&(AUTOMATIC_CHILD_ROLLUP_TYPES.has(normalizedType)||!BUILTIN_ITEM_TYPES.has(normalizedType))}function toClaimHistoryContext(entry){return{ts:entry.ts,author:entry.author,message:entry.message??null}}function resolveClaimStateContext(assigneeValue,history){const assignee=assigneeValue?.trim(),normalizedAssignee=assignee&&assignee.length>0?assignee:null,lastClaim=[...history].reverse().find(entry=>entry.op==="claim"),lastRelease=[...history].reverse().find(entry=>entry.op==="release");return{claimed:normalizedAssignee!==null,assignee:normalizedAssignee,last_claim:lastClaim?toClaimHistoryContext(lastClaim):null,last_release:lastRelease?toClaimHistoryContext(lastRelease):null}}function parseGetDepth(raw){if(raw===void 0||raw.trim().length===0)return"standard";const normalized=raw.trim().toLowerCase();if(normalized==="full")return"deep";if(GET_DEPTH_VALUES.includes(normalized))return normalized;throw new PmCliError("Get --depth must be one of brief|standard|deep|full",EXIT_CODE.USAGE,{field:"depth",value:raw,recovery:{allowed_values:[...GET_DEPTH_INPUT_VALUES]}})}function projectItemForDepth(item,depth,full){const collectionCounts=itemCollectionCounts(item),projectedItem={...item};if(!full&&item.dependencies!==void 0&&(projectedItem.dependencies=item.dependencies.map(({id,kind})=>({id,kind}))),depth==="deep")return{...projectedItem,comments:item.comments??[],notes:item.notes??[],learnings:item.learnings??[],files:item.files??[],tests:item.tests??[],docs:item.docs??[],reminders:item.reminders??[],events:item.events??[],notes_count:collectionCounts.notes,tests_count:collectionCounts.tests,collection_counts:collectionCounts};const{comments:_comments,notes:_notes,learnings:_learnings,files:_files,tests:_tests,docs:_docs,reminders:_reminders,events:_events,...projected}=projectedItem;return{...projected,notes_count:item.notes?.length??0,tests_count:item.tests?.length??0,collection_counts:collectionCounts}}function parseGetFields(raw){if(raw===void 0)return null;const fields=raw.split(",").map(entry=>entry.trim()).filter(entry=>entry.length>0);if(fields.length===0)throw new PmCliError("Get --fields requires a comma-separated list of field names",EXIT_CODE.USAGE);return fields}function normalizeGetField(field){return field.startsWith("item.")?field.slice(5):field}function validateGetFields(fields,runtimeMetadataKeys,id){if(fields===null)return;const allowedValues=listGetProjectionFields(runtimeMetadataKeys),allowed=new Set(allowedValues),unknown=fields.filter(field=>{const normalized=normalizeGetField(field);return!allowed.has(field)&&!allowed.has(normalized)});if(unknown.length>0){const suggestedRetryArguments=["get",id,"--fields",fields.filter(field=>!unknown.includes(field)).join(",")||"id,title,status"];throw new PmCliError(`Unknown get --fields value(s): ${unknown.join(", ")}`,EXIT_CODE.USAGE,{code:"unknown_field_projection",examples:["pm get <id> --fields id,title,status,type,updated_at","pm get <id> --fields id,title,claim_state","pm get <id> --fields id,title,body,linked.files"],recovery:{allowed_values:allowedValues,suggested_retry:renderPmCommand(suggestedRetryArguments),suggested_retry_args:suggestedRetryArguments}})}}const EMPTY_PROJECTED_COLLECTION_FIELDS=new Set(["comments","notes","learnings","files","tests","test_runs","docs","reminders","events","dependencies","plan_steps","plan_decisions","plan_discoveries","plan_validation"]);function projectedMetadataValue(source,counts,field){return Object.hasOwn(counts,field)?counts[field]:source[field]!==void 0?source[field]:EMPTY_PROJECTED_COLLECTION_FIELDS.has(field)?[]:void 0}const GET_FACET_ROOTS=new Set(["body","item_hash","linked","claim_state","children","schedule","blockers"]),GET_NESTED_FACET_ROOTS=new Set(["linked","claim_state","children","schedule"]);function isGetFacetSelector(field,normalized){if(field==="item.item_hash")return!1;const dot=normalized.indexOf(".");return dot===-1?GET_FACET_ROOTS.has(normalized):GET_NESTED_FACET_ROOTS.has(normalized.slice(0,dot))}function projectItemForFields(item,fields){const source=toItemRecord(item),omittedCounts={notes_count:item.notes?.length??0,tests_count:item.tests?.length??0,collection_counts:itemCollectionCounts(item)},projected={id:item.id};for(const field of fields){const normalized=normalizeGetField(field);isGetFacetSelector(field,normalized)||(projected[normalized]=projectedMetadataValue(source,omittedCounts,normalized))}return projected}function fieldsInclude(fields,name){return fields?.some(field=>field===name||field===`item.${name}`)??!1}function fieldsIncludeRoot(fields,name){return fields.some(field=>{const normalized=normalizeGetField(field);return normalized===name||normalized.startsWith(`${name}.`)})}function resolveGetProjection(options,id){if(options.full&&(options.fields!==void 0||options.depth!==void 0))throw new PmCliError("Get projection options are mutually exclusive; remove the extra projection flag and retry.",EXIT_CODE.USAGE,{code:"projection_options_mutually_exclusive",flag:"--full",recovery:{suggested_retry:renderPmCommand(["get",id,"--full"]),suggested_retry_args:["get",id,"--full"]}});if(options.tree!==!0&&options.treeDepth!==void 0)throw new PmCliError("Get --tree-depth requires --tree",EXIT_CODE.USAGE);if(options.at!==void 0&&options.tree===!0)throw new PmCliError("Get --at cannot be combined with --tree because workspace-level historical projections are not yet indexed.",EXIT_CODE.USAGE);return{depth:options.full?"deep":parseGetDepth(options.depth),full:options.full===!0||options.depth?.trim().toLowerCase()==="full",treeDepth:options.tree===!0?parseIntegerLimit(options.treeDepth,"--tree-depth"):void 0,fields:parseGetFields(options.fields),fieldProjection:options.fields!==void 0}}async function loadGetItemContext(id,global2,at){const pmRoot=resolvePmRoot(process.cwd(),global2.path);await assertInitializedTracker(pmRoot);const settings=await readSettings(pmRoot),typeRegistry=resolveItemTypeRegistry(settings,getActiveExtensionRegistrations());if(at!==void 0){const historical=await getItemAt(id,at,{pmRoot:global2.path});return{pmRoot,settings,typeToFolder:typeRegistry.type_to_folder,locatedId:historical.document.metadata.id,metadata:historical.document.metadata,body:historical.document.body,historical}}const located=await locateItem(pmRoot,id,settings.id_prefix,settings.item_format,typeRegistry.type_to_folder);if(!located)throw await buildItemNotFoundError(pmRoot,id,settings.id_prefix,typeRegistry.type_to_folder);const loaded=await readLocatedItem(located,{schema:settings.schema});return{pmRoot,settings,typeToFolder:typeRegistry.type_to_folder,locatedId:located.id,metadata:loaded.document.metadata,body:loaded.document.body}}function validateGetProjectionFields(fields,settings,historical,id){const runtimeMetadataKeys=[...resolveRuntimeFieldRegistry(settings.schema).definitions.map(field=>field.metadata_key),...collectRegisteredItemFieldNames(getActiveExtensionRegistrations())];if(validateGetFields(fields,runtimeMetadataKeys,id),historical&&fieldsIncludeRoot(fields??[],"children"))throw new PmCliError("Get --at cannot project children because workspace-level historical relationships are not yet indexed.",EXIT_CODE.USAGE);if(historical&&fieldsIncludeRoot(fields??[],"blockers"))throw new PmCliError("Get --at cannot project current blocker statuses; read the current item with --fields blockers instead.",EXIT_CODE.USAGE)}function shouldIncludeGetField(params){const{fieldProjection,depth,fields,field}=params;return fieldProjection?field==="body"||field==="linked"?fieldsInclude(fields,field):fieldsIncludeRoot(fields,field):depth!=="brief"}async function resolveGetClaimState(context,includeClaimState){if(!includeClaimState)return;const historyPath=getHistoryPath(context.pmRoot,context.locatedId),history=await readHistoryEntries(historyPath,context.locatedId);return resolveClaimStateContext(context.metadata.assignee,context.historical?history.slice(0,context.historical.target.historyIndex+1):history)}function attachGetItemHash(result,context,projection){context.historical===void 0&&(projection.fieldProjection&&!projection.fields.includes("item_hash")||(result.item_hash=hashDocument({metadata:context.metadata,body:context.body})))}function attachGetLinked(result,context,fields,includeLinked){const includeLinkedFiles=includeLinked||fieldsInclude(fields,"linked.files"),includeLinkedTests=includeLinked||fieldsInclude(fields,"linked.tests"),includeLinkedDocs=includeLinked||fieldsInclude(fields,"linked.docs");!includeLinked&&!includeLinkedFiles&&!includeLinkedTests&&!includeLinkedDocs||(result.linked={files:includeLinkedFiles?context.metadata.files??[]:[],tests:includeLinkedTests?context.metadata.tests??[]:[],docs:includeLinkedDocs?context.metadata.docs??[]:[]})}async function buildGetChildrenRollup(context,includeChildren){if(!includeChildren)return;const statusRegistry=resolveRuntimeStatusRegistry(context.settings.schema),corpus=await listAllItemMetadataLight(context.pmRoot,context.settings.item_format,context.typeToFolder,void 0,context.settings.schema);return buildItemChildrenRollup(context.locatedId,corpus,statusRegistry)}async function attachGetBlockers(result,context,projection){if(context.historical!==void 0||!(projection.fieldProjection?fieldsIncludeRoot(projection.fields,"blockers"):projection.depth!=="brief")||collectBlockedByIds(context.metadata).length===0)return;const resolved=await resolveDeclaredBlockers({pmRoot:context.pmRoot,settings:context.settings,typeToFolder:context.typeToFolder,metadata:context.metadata});result.blockers={scope:"declared",open:resolved.filter(blocker=>!blocker.resolved).map(({resolved:_resolved,...blocker})=>blocker),closed_count:resolved.filter(blocker=>blocker.resolved).length},!projection.fieldProjection&&!projection.full&&delete result.item.blocked_by}function attachGetSchedule(result,context,fields,includeSchedule){if(!includeSchedule)return;const schedule=buildItemSchedule(context.metadata);if(schedule){if(fields===null||fieldsInclude(fields,"schedule")){result.schedule=schedule;return}result.schedule=Object.fromEntries(Object.entries(schedule).filter(([key])=>fields.some(field=>normalizeGetField(field)===`schedule.${key}`)))}}async function buildGetTree(context,options,treeDepth,global2){if(options.tree!==!0)return;const subtree=await runList(void 0,{parent:context.locatedId,tree:!0,treeDepth:treeDepth===void 0?void 0:String(treeDepth),full:!0},global2);return{root_id:context.locatedId,root_title:context.metadata.title,depth_limit:treeDepth??null,count:subtree.count,items:subtree.items.map(entry=>toItemRecord(entry))}}async function runGet(id,global2,options={}){const projection=resolveGetProjection(options,id),context=await loadGetItemContext(id,global2,options.at);validateGetProjectionFields(projection.fields,context.settings,context.historical!==void 0,context.locatedId);const includeBody=shouldIncludeGetField({...projection,field:"body"}),includeLinked=shouldIncludeGetField({...projection,field:"linked"}),includeClaimState=shouldIncludeGetField({...projection,field:"claim_state"}),includeChildren=context.historical===void 0&&(projection.fieldProjection?fieldsIncludeRoot(projection.fields,"children"):projection.depth==="deep"&&(projection.full||shouldAutoIncludeGetChildren(context.metadata.type))),includeSchedule=projection.fieldProjection?fieldsIncludeRoot(projection.fields,"schedule"):projection.depth!=="brief",claimState=await resolveGetClaimState(context,includeClaimState),result={item:projection.fieldProjection?projectItemForFields(context.metadata,projection.fields):projectItemForDepth(context.metadata,projection.depth,projection.full)};includeBody&&(result.item.body=context.body),attachGetItemHash(result,context,projection),attachGetLinked(result,context,projection.fields,includeLinked),claimState&&(result.claim_state=claimState),attachGetSchedule(result,context,projection.fields,includeSchedule),await attachGetBlockers(result,context,projection);const children=await buildGetChildrenRollup(context,includeChildren);children!==void 0&&(result.children=children);const tree=await buildGetTree(context,options,projection.treeDepth,global2);if(tree!==void 0&&(result.tree=tree),context.historical&&(result.reconstructed=!0,result.as_of_version=context.historical.as_of_version,result.as_of_timestamp=context.historical.as_of_timestamp),context.historical===void 0)try{await recordContextUsageTouches({pmRoot:context.pmRoot,author:resolveAuthor(void 0,context.settings.author_default),itemIds:[context.locatedId],intent:"get"})}catch{}return registerOutputMaterialFieldGroups(result,projection.fieldProjection?[]:itemMaterialFieldGroups(context.metadata,context.body,children,context.historical===void 0,projection)),result}const _testOnlyGetCommand={shouldAutoIncludeGetChildren};export{GET_DEPTH_INPUT_VALUES2 as GET_DEPTH_INPUT_VALUES,GET_DEPTH_VALUES2 as GET_DEPTH_VALUES,_testOnlyGetCommand,listGetProjectionFields2 as listGetProjectionFields,runGet};
1
+ (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="150fe00b-6384-5d3e-8cef-6afedb05b1a7")}catch{}})();import{collectRegisteredItemFieldNames}from"../../core/extensions/item-fields.js";import{assertInitializedTracker}from"../environment/tracker-preflight.js";import{getActiveExtensionRegistrations,toItemRecord,resolveItemTypeRegistry,resolveRuntimeFieldRegistry,resolveRuntimeStatusRegistry,EXIT_CODE,TYPE_TO_FOLDER,PmCliError,buildItemNotFoundError,listAllItemMetadataLight,locateItem,readLocatedItem,getHistoryPath,resolvePmRoot,readSettings,resolveAuthor}from"../runtime-primitives.js";import{readHistoryEntries}from"../history-read.js";import{hashDocument}from"../../core/history/history.js";import{renderPmCommand}from"../command-line.js";import{recordContextUsageTouches}from"../context-usage.js";import{collectBlockedByIds}from"../actionability.js";import{resolveDeclaredBlockers}from"./declared-blockers.js";import{buildItemChildrenRollup}from"../item-children.js";import{buildItemSchedule}from"../item-schedule.js";import{getItemAt}from"../history-read.js";import{parseIntegerLimit}from"./parsers.js";import{runList}from"./list.js";import{registerOutputMaterialFieldGroups}from"../output-projection.js";import{GET_DEPTH_INPUT_VALUES,GET_DEPTH_VALUES,listGetProjectionFields}from"./projection-contracts.js";import{GET_DEPTH_INPUT_VALUES as GET_DEPTH_INPUT_VALUES2,GET_DEPTH_VALUES as GET_DEPTH_VALUES2,listGetProjectionFields as listGetProjectionFields2}from"./projection-contracts.js";const AUTOMATIC_CHILD_ROLLUP_TYPES=new Set(["epic","feature","milestone","plan"]),BUILTIN_ITEM_TYPES=new Set(Object.keys(TYPE_TO_FOLDER).map(type=>type.toLowerCase()));function itemCollectionCounts(item){return Object.fromEntries(["comments","notes","learnings","files","tests","docs","reminders","events"].map(key=>[key,item[key]?.length??0]))}function itemMaterialFieldGroups(item,body,children,currentSnapshot,projection){const collectionCounts=itemCollectionCounts(item);return[...body.length>0?["body"]:[],...Object.entries(collectionCounts).flatMap(([name,count])=>count>0?[name]:[]),...collectionCounts.files+collectionCounts.tests+collectionCounts.docs>0?["linked"]:[],...children===void 0?["children"]:children.count>0?["children"]:[],...typeof item.assignee=="string"&&item.assignee.trim().length>0?["claim_state"]:[],...buildItemSchedule(item)?["schedule"]:[],...currentSnapshot&&collectBlockedByIds(item).length>0?["blockers"]:[],...!projection.full&&item.dependencies?.some(({id:_id,kind:_kind,...provenance})=>Object.values(provenance).some(value=>value!==void 0))?["dependency_provenance"]:[]]}function shouldAutoIncludeGetChildren(itemType){const normalizedType=itemType.trim().toLowerCase();return normalizedType.length>0&&(AUTOMATIC_CHILD_ROLLUP_TYPES.has(normalizedType)||!BUILTIN_ITEM_TYPES.has(normalizedType))}function toClaimHistoryContext(entry){return{ts:entry.ts,author:entry.author,message:entry.message??null}}function resolveClaimStateContext(assigneeValue,history){const assignee=assigneeValue?.trim(),normalizedAssignee=assignee&&assignee.length>0?assignee:null,lastClaim=[...history].reverse().find(entry=>entry.op==="claim"),lastRelease=[...history].reverse().find(entry=>entry.op==="release");return{claimed:normalizedAssignee!==null,assignee:normalizedAssignee,last_claim:lastClaim?toClaimHistoryContext(lastClaim):null,last_release:lastRelease?toClaimHistoryContext(lastRelease):null}}function parseGetDepth(raw){if(raw===void 0||raw.trim().length===0)return"standard";const normalized=raw.trim().toLowerCase();if(normalized==="full")return"deep";if(GET_DEPTH_VALUES.includes(normalized))return normalized;throw new PmCliError("Get --depth must be one of brief|standard|deep|full",EXIT_CODE.USAGE,{field:"depth",value:raw,recovery:{allowed_values:[...GET_DEPTH_INPUT_VALUES]}})}function projectItemForDepth(item,depth,full){const collectionCounts=itemCollectionCounts(item),projectedItem={...item};if(!full&&item.dependencies!==void 0&&(projectedItem.dependencies=item.dependencies.map(({id,kind})=>({id,kind}))),depth==="deep")return{...projectedItem,comments:item.comments??[],notes:item.notes??[],learnings:item.learnings??[],files:item.files??[],tests:item.tests??[],docs:item.docs??[],reminders:item.reminders??[],events:item.events??[],notes_count:collectionCounts.notes,tests_count:collectionCounts.tests,collection_counts:collectionCounts};const{comments:_comments,notes:_notes,learnings:_learnings,files:_files,tests:_tests,docs:_docs,reminders:_reminders,events:_events,...projected}=projectedItem;return{...projected,notes_count:item.notes?.length??0,tests_count:item.tests?.length??0,collection_counts:collectionCounts}}function parseGetFields(raw){if(raw===void 0)return null;const fields=raw.split(",").map(entry=>entry.trim()).filter(entry=>entry.length>0);if(fields.length===0)throw new PmCliError("Get --fields requires a comma-separated list of field names",EXIT_CODE.USAGE);return fields}function normalizeGetField(field){return field.startsWith("item.")?field.slice(5):field}function validateGetFields(fields,runtimeMetadataKeys,id){if(fields===null)return;const allowedValues=listGetProjectionFields(runtimeMetadataKeys),allowed=new Set(allowedValues),unknown=fields.filter(field=>{const normalized=normalizeGetField(field);return!allowed.has(field)&&!allowed.has(normalized)});if(unknown.length>0){const suggestedRetryArguments=["get",id,"--fields",fields.filter(field=>!unknown.includes(field)).join(",")||"id,title,status"];throw new PmCliError(`Unknown get --fields value(s): ${unknown.join(", ")}`,EXIT_CODE.USAGE,{code:"unknown_field_projection",examples:["pm get <id> --fields id,title,status,type,updated_at","pm get <id> --fields id,title,claim_state","pm get <id> --fields id,title,body,linked.files"],recovery:{allowed_values:allowedValues,suggested_retry:renderPmCommand(suggestedRetryArguments),suggested_retry_args:suggestedRetryArguments}})}}const EMPTY_PROJECTED_COLLECTION_FIELDS=new Set(["comments","notes","learnings","files","tests","test_runs","docs","reminders","events","dependencies","plan_steps","plan_decisions","plan_discoveries","plan_validation"]);function projectedMetadataValue(source,counts,field){return Object.hasOwn(counts,field)?counts[field]:source[field]!==void 0?source[field]:EMPTY_PROJECTED_COLLECTION_FIELDS.has(field)?[]:void 0}const GET_FACET_ROOTS=new Set(["body","item_hash","linked","claim_state","children","schedule","blockers"]),GET_NESTED_FACET_ROOTS=new Set(["linked","claim_state","children","schedule"]);function isGetFacetSelector(field,normalized){if(field==="item.item_hash")return!1;const dot=normalized.indexOf(".");return dot===-1?GET_FACET_ROOTS.has(normalized):GET_NESTED_FACET_ROOTS.has(normalized.slice(0,dot))}function projectItemForFields(item,fields){const source=toItemRecord(item),omittedCounts={notes_count:item.notes?.length??0,tests_count:item.tests?.length??0,collection_counts:itemCollectionCounts(item)},projected={id:item.id};for(const field of fields){const normalized=normalizeGetField(field);isGetFacetSelector(field,normalized)||(projected[normalized]=projectedMetadataValue(source,omittedCounts,normalized))}return projected}function fieldsInclude(fields,name){return fields?.some(field=>field===name||field===`item.${name}`)??!1}function fieldsIncludeRoot(fields,name){return fields.some(field=>{const normalized=normalizeGetField(field);return normalized===name||normalized.startsWith(`${name}.`)})}function resolveGetProjection(options,id){if(options.full&&(options.fields!==void 0||options.depth!==void 0))throw new PmCliError("Get projection options are mutually exclusive; remove the extra projection flag and retry.",EXIT_CODE.USAGE,{code:"projection_options_mutually_exclusive",flag:"--full",recovery:{suggested_retry:renderPmCommand(["get",id,"--full"]),suggested_retry_args:["get",id,"--full"]}});if(options.tree!==!0&&options.treeDepth!==void 0)throw new PmCliError("Get --tree-depth requires --tree",EXIT_CODE.USAGE);if(options.at!==void 0&&options.tree===!0)throw new PmCliError("Get --at cannot be combined with --tree because workspace-level historical projections are not yet indexed.",EXIT_CODE.USAGE);return{depth:options.full?"deep":parseGetDepth(options.depth),full:options.full===!0||options.depth?.trim().toLowerCase()==="full",treeDepth:options.tree===!0?parseIntegerLimit(options.treeDepth,"--tree-depth"):void 0,fields:parseGetFields(options.fields),fieldProjection:options.fields!==void 0}}async function loadGetItemContext(id,global2,at){const pmRoot=resolvePmRoot(process.cwd(),global2.path);await assertInitializedTracker(pmRoot);const settings=await readSettings(pmRoot),typeRegistry=resolveItemTypeRegistry(settings,getActiveExtensionRegistrations());if(at!==void 0){const historical=await getItemAt(id,at,{pmRoot:global2.path});return{pmRoot,settings,typeToFolder:typeRegistry.type_to_folder,locatedId:historical.document.metadata.id,metadata:historical.document.metadata,body:historical.document.body,historical}}const located=await locateItem(pmRoot,id,settings.id_prefix,settings.item_format,typeRegistry.type_to_folder);if(!located)throw await buildItemNotFoundError(pmRoot,id,settings.id_prefix,typeRegistry.type_to_folder);const loaded=await readLocatedItem(located,{schema:settings.schema});return{pmRoot,settings,typeToFolder:typeRegistry.type_to_folder,locatedId:located.id,metadata:loaded.document.metadata,body:loaded.document.body}}function validateGetProjectionFields(fields,settings,historical,id){const runtimeMetadataKeys=[...resolveRuntimeFieldRegistry(settings.schema).definitions.map(field=>field.metadata_key),...collectRegisteredItemFieldNames(getActiveExtensionRegistrations())];if(validateGetFields(fields,runtimeMetadataKeys,id),historical&&fieldsIncludeRoot(fields??[],"children"))throw new PmCliError("Get --at cannot project children because workspace-level historical relationships are not yet indexed.",EXIT_CODE.USAGE);if(historical&&fieldsIncludeRoot(fields??[],"blockers"))throw new PmCliError("Get --at cannot project current blocker statuses; read the current item with --fields blockers instead.",EXIT_CODE.USAGE)}function shouldIncludeGetField(params){const{fieldProjection,depth,fields,field}=params;return fieldProjection?field==="body"||field==="linked"?fieldsInclude(fields,field):fieldsIncludeRoot(fields,field):depth!=="brief"}async function resolveGetClaimState(context,includeClaimState){if(!includeClaimState)return;const historyPath=getHistoryPath(context.pmRoot,context.locatedId),history=await readHistoryEntries(historyPath,context.locatedId);return resolveClaimStateContext(context.metadata.assignee,context.historical?history.slice(0,context.historical.target.historyIndex+1):history)}function attachGetItemHash(result,context,projection){context.historical===void 0&&(projection.fieldProjection&&!projection.fields.includes("item_hash")||(result.item_hash=hashDocument({metadata:context.metadata,body:context.body})))}const LINKED_GROUPS=["files","tests","docs"],CLAIM_STATE_MEMBERS=["claimed","assignee","last_claim","last_release"];function attachGetLinked(result,context,fields,includeLinked){const selected=LINKED_GROUPS.filter(group=>includeLinked||fieldsInclude(fields,`linked.${group}`));selected.length!==0&&(result.linked=Object.fromEntries(selected.map(group=>[group,context.metadata[group]??[]])))}function projectGetClaimState(claimState,fields){return fields===null||fieldsInclude(fields,"claim_state")?claimState:Object.fromEntries(CLAIM_STATE_MEMBERS.filter(member=>fields.some(field=>normalizeGetField(field)===`claim_state.${member}`)).map(member=>[member,claimState[member]]))}const NESTED_MEMBER_METADATA_ALIASES={linked:new Set(LINKED_GROUPS),schedule:new Set(["deadline","reminders","events"]),claim_state:new Set(["assignee"])};function nestedFieldSiblingGroups(fields,facet,members){const normalized=fields.map(normalizeGetField);if(normalized.includes(facet))return[];const prefix=`${facet}.`;if(!normalized.some(field=>field.startsWith(prefix)))return[];const aliases=NESTED_MEMBER_METADATA_ALIASES[facet];return Object.entries(members).flatMap(([member,value])=>!normalized.includes(`${prefix}${member}`)&&!(aliases.has(member)&&normalized.includes(member))&&isMaterialFacetMember(value)?[`${prefix}${member}`]:[])}function isMaterialFacetMember(value){return value!=null&&value!==!1&&!(Array.isArray(value)&&value.length===0)}function getFieldProjectionMaterialGroups(context,fields,claimState){return[...nestedFieldSiblingGroups(fields,"linked",{files:context.metadata.files,tests:context.metadata.tests,docs:context.metadata.docs}),...claimState?nestedFieldSiblingGroups(fields,"claim_state",claimState):[],...nestedFieldSiblingGroups(fields,"schedule",buildItemSchedule(context.metadata)??{})]}async function buildGetChildrenRollup(context,includeChildren){if(!includeChildren)return;const statusRegistry=resolveRuntimeStatusRegistry(context.settings.schema),corpus=await listAllItemMetadataLight(context.pmRoot,context.settings.item_format,context.typeToFolder,void 0,context.settings.schema);return buildItemChildrenRollup(context.locatedId,corpus,statusRegistry)}async function attachGetBlockers(result,context,projection){if(context.historical!==void 0||!(projection.fieldProjection?fieldsIncludeRoot(projection.fields,"blockers"):projection.depth!=="brief")||collectBlockedByIds(context.metadata).length===0)return;const resolved=await resolveDeclaredBlockers({pmRoot:context.pmRoot,settings:context.settings,typeToFolder:context.typeToFolder,metadata:context.metadata});result.blockers={scope:"declared",open:resolved.filter(blocker=>!blocker.resolved).map(({resolved:_resolved,...blocker})=>blocker),closed_count:resolved.filter(blocker=>blocker.resolved).length},!projection.fieldProjection&&!projection.full&&delete result.item.blocked_by}function attachGetSchedule(result,context,fields,includeSchedule){if(!includeSchedule)return;const schedule=buildItemSchedule(context.metadata);if(schedule){if(fields===null||fieldsInclude(fields,"schedule")){result.schedule=schedule;return}result.schedule=Object.fromEntries(Object.entries(schedule).filter(([key])=>fields.some(field=>normalizeGetField(field)===`schedule.${key}`)))}}async function buildGetTree(context,options,treeDepth,global2){if(options.tree!==!0)return;const subtree=await runList(void 0,{parent:context.locatedId,tree:!0,treeDepth:treeDepth===void 0?void 0:String(treeDepth),full:!0},global2);return{root_id:context.locatedId,root_title:context.metadata.title,depth_limit:treeDepth??null,count:subtree.count,items:subtree.items.map(entry=>toItemRecord(entry))}}async function runGet(id,global2,options={}){const projection=resolveGetProjection(options,id),context=await loadGetItemContext(id,global2,options.at);validateGetProjectionFields(projection.fields,context.settings,context.historical!==void 0,context.locatedId);const includeBody=shouldIncludeGetField({...projection,field:"body"}),includeLinked=shouldIncludeGetField({...projection,field:"linked"}),includeClaimState=shouldIncludeGetField({...projection,field:"claim_state"}),includeChildren=context.historical===void 0&&(projection.fieldProjection?fieldsIncludeRoot(projection.fields,"children"):projection.depth==="deep"&&(projection.full||shouldAutoIncludeGetChildren(context.metadata.type))),includeSchedule=projection.fieldProjection?fieldsIncludeRoot(projection.fields,"schedule"):projection.depth!=="brief",claimState=await resolveGetClaimState(context,includeClaimState),result={item:projection.fieldProjection?projectItemForFields(context.metadata,projection.fields):projectItemForDepth(context.metadata,projection.depth,projection.full)};includeBody&&(result.item.body=context.body),attachGetItemHash(result,context,projection),attachGetLinked(result,context,projection.fields,includeLinked),claimState&&(result.claim_state=projectGetClaimState(claimState,projection.fields)),attachGetSchedule(result,context,projection.fields,includeSchedule),await attachGetBlockers(result,context,projection);const children=await buildGetChildrenRollup(context,includeChildren);children!==void 0&&(result.children=children);const tree=await buildGetTree(context,options,projection.treeDepth,global2);if(tree!==void 0&&(result.tree=tree),context.historical&&(result.reconstructed=!0,result.as_of_version=context.historical.as_of_version,result.as_of_timestamp=context.historical.as_of_timestamp),context.historical===void 0)try{await recordContextUsageTouches({pmRoot:context.pmRoot,author:resolveAuthor(void 0,context.settings.author_default),itemIds:[context.locatedId],intent:"get"})}catch{}return registerOutputMaterialFieldGroups(result,projection.fieldProjection?getFieldProjectionMaterialGroups(context,projection.fields,claimState):itemMaterialFieldGroups(context.metadata,context.body,children,context.historical===void 0,projection)),result}const _testOnlyGetCommand={shouldAutoIncludeGetChildren};export{GET_DEPTH_INPUT_VALUES2 as GET_DEPTH_INPUT_VALUES,GET_DEPTH_VALUES2 as GET_DEPTH_VALUES,_testOnlyGetCommand,listGetProjectionFields2 as listGetProjectionFields,runGet};
2
2
  //# sourceMappingURL=get.js.map
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="d7beacb7-66a5-581f-93f0-68ceb4b8e41e")}catch{}})();import{toItemRecord}from"../../../core/item/item-record.js";import{nowIso}from"../../../core/shared/time.js";import{buildCompactSearchFilterSummary,buildVerboseSearchFilters}from"../search-rendering.js";import{buildHitHighlights}from"./lexical.js";function emptySearchResult(query,mode,matchMode,options,includeLinked,scoreThreshold,hybridSemanticWeight,queryExpansion,rerank,projection,warnings,runtimeFieldFilters,countOnly,modeSource){const countExtras=countOnly?{total:0,count_only:!0}:{};if(projection.mode==="compact"&&options.compact===!0){const compactFilters=buildCompactSearchFilterSummary({mode,matchMode,options,includeLinked,titleExact:options.titleExact===!0,phraseExact:options.phraseExact===!0,scoreThreshold,hybridSemanticWeight,runtimeFieldFilters});return{query:query.trim(),mode,...compactModeSource(modeSource),items:[],count:0,...countExtras,filters:compactFilters,...warnings.length>0?{warnings}:{}}}const projectionFields=projection.mode==="full"?null:[...projection.fields];return{query:query.trim(),mode,mode_source:modeSource,items:[],count:0,...countExtras,filters:buildVerboseSearchFilters({effectiveMode:mode,matchMode,options,includeLinked,titleExact:options.titleExact===!0,phraseExact:options.phraseExact===!0,scoreThreshold,hybridSemanticWeight,queryExpansion,rerank,runtimeFieldFilters:runtimeFieldFilters??{}}),projection:{mode:projection.mode,fields:projectionFields},now:nowIso(),...warnings.length>0?{warnings}:{}}}function readSearchFieldValue(hit,field){const normalized=field.trim();if(normalized.length===0)return null;if(normalized==="score")return hit.score;if(normalized==="matched_fields")return hit.matched_fields;if(normalized.startsWith("item.")){const itemKey=normalized.slice(5);return itemKey.length===0?null:toItemRecord(hit.item)[itemKey]??null}const hitRecord=hit,itemRecord=toItemRecord(hit.item);return Object.prototype.hasOwnProperty.call(itemRecord,normalized)?itemRecord[normalized]??null:Object.prototype.hasOwnProperty.call(hitRecord,normalized)?hitRecord[normalized]??null:null}function projectSearchHits(hits,projection){return projection.mode==="full"?hits.map(({matched_all_terms:_matchedAllTerms,exact_id_match:_exactIdMatch,...hit})=>hit):hits.map(hit=>{const projected={};for(const field of projection.fields)projected[field]=readSearchFieldValue(hit,field);return projected})}function buildEmptySearchResultFromContext(response,countOnly){return emptySearchResult(response.query,response.effectiveMode,response.matchMode,response.options,response.includeLinked,response.scoreThreshold,response.hybridSemanticWeight,response.queryExpansion,response.rerank,response.projection,response.warnings,response.runtimeFieldFilters,countOnly,response.modeSource)}function buildCountOnlySearchResult(response,total){if(response.projection.mode==="compact"&&response.options.compact===!0)return withSearchWarnings({query:response.query.trim(),mode:response.effectiveMode,...compactModeSource(response.modeSource),items:[],count:total,total,count_only:!0,filters:buildCompactSearchFilterSummary({mode:response.effectiveMode,matchMode:response.matchMode,options:response.options,includeLinked:response.includeLinked,titleExact:response.titleExact,phraseExact:response.phraseExact,scoreThreshold:response.scoreThreshold,hybridSemanticWeight:response.hybridSemanticWeight,runtimeFieldFilters:response.runtimeFieldFilters})},response.warnings);const projectionFields=response.projection.mode==="full"?null:[...response.projection.fields];return withSearchWarnings({query:response.query.trim(),mode:response.effectiveMode,mode_source:response.modeSource,items:[],count:total,total,count_only:!0,filters:buildVerboseSearchFilters({effectiveMode:response.effectiveMode,matchMode:response.matchMode,options:response.options,includeLinked:response.includeLinked,titleExact:response.titleExact,phraseExact:response.phraseExact,scoreThreshold:response.scoreThreshold,hybridSemanticWeight:response.hybridSemanticWeight,queryExpansion:response.queryExpansion,rerank:response.rerank,runtimeFieldFilters:response.runtimeFieldFilters}),projection:{mode:response.projection.mode,fields:projectionFields},now:nowIso()},response.warnings)}function compactModeSource(source){return source==="settings"?{mode_source:source}:{}}function withSearchWarnings(result,warnings){return warnings.length===0?result:{...result,warnings}}function withSearchWorkspaceMemory(result,memory){return memory?{...result,workspace_memory:memory}:result}function attachSearchHighlights(prepared,filteredDocuments,limited){if(!prepared.highlight)return{hits:limited,projection:prepared.projection};const documentById=new Map(filteredDocuments.map(document=>[document.metadata.id,document])),hits=limited.map(hit=>({...hit,highlights:buildHitHighlights(documentById.get(hit.item.id),hit.matched_fields,prepared.tokens)}));return prepared.projection.mode==="full"||prepared.projection.fields.includes("highlights")?{hits,projection:prepared.projection}:{hits,projection:{mode:prepared.projection.mode,fields:[...prepared.projection.fields,"highlights"]}}}function buildSearchResultForHits(response,projectedItems,total,limitedCount,effectiveProjection,pageExtras){const truncationExtras=limitedCount<total?{total}:{};if(response.projection.mode==="compact"&&response.options.compact===!0)return withSearchWarnings({query:response.query.trim(),mode:response.effectiveMode,...compactModeSource(response.modeSource),items:projectedItems,count:projectedItems.length,...truncationExtras,...pageExtras,filters:buildCompactSearchFilterSummary({mode:response.effectiveMode,matchMode:response.matchMode,options:response.options,includeLinked:response.includeLinked,titleExact:response.titleExact,phraseExact:response.phraseExact,scoreThreshold:response.scoreThreshold,hybridSemanticWeight:response.hybridSemanticWeight,runtimeFieldFilters:response.runtimeFieldFilters})},response.warnings);const finalProjectionFields=effectiveProjection.mode==="full"?null:[...effectiveProjection.fields];return{query:response.query.trim(),mode:response.effectiveMode,mode_source:response.modeSource,items:projectedItems,count:projectedItems.length,...truncationExtras,...pageExtras,filters:buildVerboseSearchFilters({effectiveMode:response.effectiveMode,matchMode:response.matchMode,options:response.options,includeLinked:response.includeLinked,titleExact:response.titleExact,phraseExact:response.phraseExact,scoreThreshold:response.scoreThreshold,hybridSemanticWeight:response.hybridSemanticWeight,queryExpansion:response.queryExpansion,rerank:response.rerank,runtimeFieldFilters:response.runtimeFieldFilters}),projection:{mode:effectiveProjection.mode,fields:finalProjectionFields},now:nowIso(),...response.warnings.length>0?{warnings:response.warnings}:{}}}export{attachSearchHighlights,buildCountOnlySearchResult,buildEmptySearchResultFromContext,buildSearchResultForHits,emptySearchResult,projectSearchHits,readSearchFieldValue,withSearchWorkspaceMemory};
1
+ (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="5e71457b-904d-56d6-b205-1db9c71dfd08")}catch{}})();import{toItemRecord}from"../../../core/item/item-record.js";import{nowIso}from"../../../core/shared/time.js";import{buildCompactSearchFilterSummary,buildVerboseSearchFilters}from"../search-rendering.js";import{buildHitHighlights}from"./lexical.js";function emptySearchResult(query,mode,matchMode,options,includeLinked,scoreThreshold,hybridSemanticWeight,queryExpansion,rerank,projection,warnings,runtimeFieldFilters,countOnly,modeSource){const countExtras=countOnly?{total:0,count_only:!0}:{};if(projection.mode==="compact"&&options.compact===!0){const compactFilters=buildCompactSearchFilterSummary({mode,matchMode,options,includeLinked,titleExact:options.titleExact===!0,phraseExact:options.phraseExact===!0,scoreThreshold,hybridSemanticWeight,runtimeFieldFilters});return{query:query.trim(),mode,...compactModeSource(modeSource),items:[],count:0,...countExtras,filters:compactFilters,...warnings.length>0?{warnings}:{}}}const projectionFields=projection.mode==="full"?null:[...projection.fields];return{query:query.trim(),mode,mode_source:modeSource,items:[],count:0,...countExtras,filters:buildProjectedSearchFilters({effectiveMode:mode,matchMode,options,includeLinked,titleExact:options.titleExact===!0,phraseExact:options.phraseExact===!0,scoreThreshold,hybridSemanticWeight,queryExpansion,rerank,runtimeFieldFilters:runtimeFieldFilters??{}},projection),projection:{mode:projection.mode,fields:projectionFields},now:nowIso(),...warnings.length>0?{warnings}:{}}}function readSearchFieldValue(hit,field){const normalized=field.trim();if(normalized.length===0)return null;if(normalized==="score")return hit.score;if(normalized==="matched_fields")return hit.matched_fields;if(normalized.startsWith("item.")){const itemKey=normalized.slice(5);return itemKey.length===0?null:toItemRecord(hit.item)[itemKey]??null}const hitRecord=hit,itemRecord=toItemRecord(hit.item);return Object.prototype.hasOwnProperty.call(itemRecord,normalized)?itemRecord[normalized]??null:Object.prototype.hasOwnProperty.call(hitRecord,normalized)?hitRecord[normalized]??null:null}function projectSearchHits(hits,projection){return projection.mode==="full"?hits.map(({matched_all_terms:_matchedAllTerms,exact_id_match:_exactIdMatch,...hit})=>hit):hits.map(hit=>{const projected={};for(const field of projection.fields)projected[field]=readSearchFieldValue(hit,field);return projected})}function buildEmptySearchResultFromContext(response,countOnly){return emptySearchResult(response.query,response.effectiveMode,response.matchMode,response.options,response.includeLinked,response.scoreThreshold,response.hybridSemanticWeight,response.queryExpansion,response.rerank,response.projection,response.warnings,response.runtimeFieldFilters,countOnly,response.modeSource)}function buildCountOnlySearchResult(response,total){if(response.projection.mode==="compact"&&response.options.compact===!0)return withSearchWarnings({query:response.query.trim(),mode:response.effectiveMode,...compactModeSource(response.modeSource),items:[],count:total,total,count_only:!0,filters:buildCompactSearchFilterSummary({mode:response.effectiveMode,matchMode:response.matchMode,options:response.options,includeLinked:response.includeLinked,titleExact:response.titleExact,phraseExact:response.phraseExact,scoreThreshold:response.scoreThreshold,hybridSemanticWeight:response.hybridSemanticWeight,runtimeFieldFilters:response.runtimeFieldFilters})},response.warnings);const projectionFields=response.projection.mode==="full"?null:[...response.projection.fields];return withSearchWarnings({query:response.query.trim(),mode:response.effectiveMode,mode_source:response.modeSource,items:[],count:total,total,count_only:!0,filters:buildProjectedSearchFilters(response,response.projection),projection:{mode:response.projection.mode,fields:projectionFields},now:nowIso()},response.warnings)}function buildProjectedSearchFilters(response,projection){const shared={matchMode:response.matchMode,options:response.options,includeLinked:response.includeLinked,titleExact:response.titleExact,phraseExact:response.phraseExact,scoreThreshold:response.scoreThreshold,hybridSemanticWeight:response.hybridSemanticWeight,runtimeFieldFilters:response.runtimeFieldFilters};return projection.mode==="fields"?buildCompactSearchFilterSummary({...shared,mode:response.effectiveMode}):buildVerboseSearchFilters({...shared,effectiveMode:response.effectiveMode,queryExpansion:response.queryExpansion,rerank:response.rerank})}function compactModeSource(source){return source==="settings"?{mode_source:source}:{}}function withSearchWarnings(result,warnings){return warnings.length===0?result:{...result,warnings}}function withSearchWorkspaceMemory(result,memory){return memory?{...result,workspace_memory:memory}:result}function attachSearchHighlights(prepared,filteredDocuments,limited){if(!prepared.highlight)return{hits:limited,projection:prepared.projection};const documentById=new Map(filteredDocuments.map(document=>[document.metadata.id,document])),hits=limited.map(hit=>({...hit,highlights:buildHitHighlights(documentById.get(hit.item.id),hit.matched_fields,prepared.tokens)}));return prepared.projection.mode==="full"||prepared.projection.fields.includes("highlights")?{hits,projection:prepared.projection}:{hits,projection:{mode:prepared.projection.mode,fields:[...prepared.projection.fields,"highlights"]}}}function buildSearchResultForHits(response,projectedItems,total,limitedCount,effectiveProjection,pageExtras){const truncationExtras=limitedCount<total?{total}:{};if(response.projection.mode==="compact"&&response.options.compact===!0)return withSearchWarnings({query:response.query.trim(),mode:response.effectiveMode,...compactModeSource(response.modeSource),items:projectedItems,count:projectedItems.length,...truncationExtras,...pageExtras,filters:buildCompactSearchFilterSummary({mode:response.effectiveMode,matchMode:response.matchMode,options:response.options,includeLinked:response.includeLinked,titleExact:response.titleExact,phraseExact:response.phraseExact,scoreThreshold:response.scoreThreshold,hybridSemanticWeight:response.hybridSemanticWeight,runtimeFieldFilters:response.runtimeFieldFilters})},response.warnings);const finalProjectionFields=effectiveProjection.mode==="full"?null:[...effectiveProjection.fields];return{query:response.query.trim(),mode:response.effectiveMode,mode_source:response.modeSource,items:projectedItems,count:projectedItems.length,...truncationExtras,...pageExtras,filters:buildProjectedSearchFilters(response,effectiveProjection),projection:{mode:effectiveProjection.mode,fields:finalProjectionFields},now:nowIso(),...response.warnings.length>0?{warnings:response.warnings}:{}}}export{attachSearchHighlights,buildCountOnlySearchResult,buildEmptySearchResultFromContext,buildSearchResultForHits,emptySearchResult,projectSearchHits,readSearchFieldValue,withSearchWorkspaceMemory};
2
2
  //# sourceMappingURL=response.js.map
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="f513a760-1161-53ac-ae6f-854930b8d891")}catch{}})();import{AsyncLocalStorage}from"node:async_hooks";import{describeUnknownError,createExtensionCommandError}from"./error-runtime.js";import{capturePmCommandScope}from"./command-line.js";import{createEmptyExtensionCommandRegistry,createEmptyExtensionHookRegistry,createEmptyExtensionParserRegistry,createEmptyExtensionPreflightRegistry,createEmptyExtensionRegistrationRegistry,createEmptyExtensionRendererRegistry,createEmptyExtensionServiceRegistry}from"../core/extensions/extension-registries.js";import{activateExtensions,deactivateExtensions,loadExtensions,runActiveCommandHandler,runWithIsolatedExtensionRuntime,setActiveExtensionCommands,setActiveExtensionHooks,setActiveExtensionParsers,setActiveExtensionPreflight,setActiveExtensionRegistrations,setActiveExtensionRenderers,setActiveExtensionServices}from"../core/extensions/index.js";import{pathExists}from"../core/fs/fs-utils.js";import{EXIT_CODE}from"../core/shared/constants.js";import{PmCliError}from"../core/shared/errors.js";import{asRecordClone}from"../core/shared/primitives.js";import{HOISTED_ACTION_OPTION_KEYS}from"./runtime-input.js";import{assertMutationOptionBag}from"./runtime/mutation-value-validation.js";import{withCliMutationInput,withLiteralMutationInput}from"./lifecycle/cli-input.js";import{createAsyncReadWriteGate}from"../core/shared/serial-queue.js";import{getSettingsPath,resolvePmRoot}from"../core/store/paths.js";import{readSettings,runWithConfigurationOnlySettings}from"../core/store/settings.js";import{resolveAuthor}from"../core/shared/author.js";import{PM_TOOL_ACTIONS}from"./cli-contracts/enum-contracts.js";import{runContracts}from"./cli-contracts/runtime-contracts.js";import{attachReadOutputContracts}from"./context-intent-contracts.js";import{runWithDiscoveredContextIntentContracts}from"./context-intent-runtime.js";import{finalizeContextUsageEgress}from"./context/usage-egress.js";import{createExtensionCommandSdk}from"./extension-command-context.js";import{INIT_INVOCATION_CWD}from"./init.js";import{certifyCompleteListResult,createCompleteListOptions}from"./query/complete-list.js";import{listClientItemMetadataLight}from"./query/light-metadata.js";import{normalizeReadOutputIncludeModeOptions,validateReadOutputOptions}from"./read-output-contracts.js";import{SDK_ACTION_ALIASES}from"./runtime-action-aliases.js";import{closeManyOptionsFromFlat,extensionOptionsFromArgs,actionGlobalOptions as globalOptions,mutationListOptions,mutationOptionsWithOverrides,normalizeActionName,normalizeCommandPath,normalizeMcpOptionsArrays,normalizeMcpUpdateOptions,optionsWithAuthor,readRuntimeScalarString as readScalarString,readRuntimeScalarStringAllowBlank as readScalarStringAllowBlank,readRuntimeString as readString,readRuntimeStringArray as readStringArray,shouldInvalidateWorkspaceContractsCacheAfterAction,splitExpectHashInput,updateManyOptionsFromFlat,withAddNoteOption,withFilesDiscoveryOptions,withMutationCompaction}from"./runtime-input.js";import{SDK_ACTION_HANDLERS}from"./runtime/actions.js";import{getOwnHandler,readRequiredString}from"./runtime/context.js";import{clearWorkspaceContractsCache}from"./workspace-contracts-cache.js";import{PM_GITIGNORE_END,PM_GITIGNORE_START,ensurePmGitignore,getPmGitignoreBlock}from"./workspace.js";import{SEARCH_EXTENSION_FLAG_DEFINITIONS}from"./extension-contracts.js";export*from"./cli-contracts/agent-output-contracts.js";import{PmCompleteListValidationError,assertCompleteListResult,certifyCompleteListResult as certifyCompleteListResult2,createCompleteListOptions as createCompleteListOptions2,inspectCompleteListResult}from"./query/complete-list.js";import{getWorkspaceContracts}from"./query/workspace-contracts.js";import{clearWorkspaceContractsCache as clearWorkspaceContractsCache2}from"./workspace-contracts-cache.js";export*from"./governance/workflow-policy.js";import{runCloseTask,runPauseTask,runStartTask}from"./lifecycle/task-composition.js";import{getActiveExtensionRegistrations,runActiveOnReadHooks,runActiveOnWriteHooks}from"../core/extensions/index.js";import{pathExists as pathExists2,readFileIfExists,removeFileIfExists,writeFileAtomic}from"../core/fs/fs-utils.js";import{appendHistoryEntry,createHistoryEntry}from"../core/history/history.js";import{HISTORY_EVENT_CLASSIFICATION_VERSION,MAINTENANCE_HISTORY_OPERATIONS,SUBSTANTIVE_HISTORY_OPERATIONS,classifyHistoryEvent}from"../core/history/event-classification.js";import{generateItemId,normalizeItemId,normalizeRawItemId}from"../core/item/id.js";import{readBooleanOption,readCsvListOption,readStringOption}from"./package-runtime-options.js";import{PM_CLI_ERROR_DETAILS_LIMITS,PM_CLI_EXPECTED_ERROR_NAME,createPmCliExpectedError,isPmCliErrorDetails,isPmCliExpectedError,projectPmCliErrorContextDetails,projectPmCliErrorDetails,snapshotPmCliErrorContext}from"./errors.js";import{commitImportedItem,emptyImportedDocument,ensureTrackerInitialized,selectImportAuthor,toEstimatedMinutesValue,toImportBoolean,toImportConfidence,toImportInteger,toImportLinkedDocs,toImportLinkedFiles,toImportLinkedTests,toImportLogEntries,toImportNormalizedEnum,toImportNumberMap,toImportPriority,toImportStatus,toImportStringList,toImportStringMap,toImportTags,toNonEmptyImportString}from"./package-import-adapters.js";import{canonicalDocument,normalizeItemMetadata,serializeItemDocument,splitFrontMatter}from"../core/item/item-format.js";import{BASELINE_ITEM_FORMAT_VERSION,CURRENT_ITEM_FORMAT_VERSION,classifyItemFormatVersion,effectiveItemFormatVersion,normalizeItemFormatVersion,scanItemFormatVersions}from"../core/item/item-format-version.js";import{parseTags}from"../core/item/parse.js";import{isTerminalStatus,normalizeStatusInput}from"../core/item/status.js";import{resolveItemTypeRegistry}from"../core/item/type-registry.js";import{acquireLock,acquireLockLease}from"../core/lock/lock.js";import{resolveRuntimeFieldRegistry,resolveRuntimeStatusRegistry}from"../core/schema/runtime-schema.js";import{PmCliError as PmCliError2}from"../core/shared/errors.js";import{isTimestampLiteral,nowIso}from"../core/shared/time.js";import{jaccardSimilarity,normalizeSimilarityText,scoreItemSimilarity,tokenizeSimilarityText}from"./similarity-scoring.js";import{listAllItemMetadata,listAllItemMetadataLight,locateItem,readLocatedItem}from"../core/store/item-store.js";import{getHistoryPath,getItemPath,getSettingsPath as getSettingsPath2,resolveImplicitPmRoot,resolvePmRoot as resolvePmRoot2}from"../core/store/paths.js";import{readSettings as readSettings2}from"../core/store/settings.js";import{runAggregate}from"./query/aggregate.js";import{CONTEXT_OUTPUT_VALUES,runContext}from"./query/context.js";import{runGet}from"./query/get.js";import{runList}from"./query/list.js";import{closeItem,runClose}from"./lifecycle/close.js";import{runCopy}from"./lifecycle/copy.js";import{runDelete}from"./lifecycle/delete.js";import{runFocus}from"./lifecycle/focus.js";import{runRestore}from"./lifecycle/restore.js";import{DEFAULT_TERMINAL_TRANSITION_POLICY,applyTerminalOrderingPolicy,requireTerminalReason,resolveTerminalReason}from"./lifecycle-policy.js";import{runUpdate}from"./lifecycle/update.js";import{runReopen}from"./lifecycle/reopen.js";import{NEXT_OUTPUT_VALUES,runNext}from"./query/next.js";import{runSearch}from"./query/search.js";import{runStats}from"./stats.js";import{runDuplicates}from"./duplicates.js";import{renderCalendarMarkdown,renderCalendarToon,resolveCalendarOutputFormat,runCalendar}from"./query/calendar.js";import{renderGuideMarkdown,resolveGuideOutputFormat,runGuide}from"./guide.js";import{runCompletion}from"./completion.js";import{runReindex}from"./governance/reindex.js";import{loadCreateTemplateOptions,runTemplatesList,runTemplatesSave,runTemplatesShow}from"./templates.js";import{runTestRunsList,runTestRunsLogs,runTestRunsResume,runTestRunsStatus,runTestRunsStop}from"./test/runs.js";import{BUILTIN_ITEM_TYPE_VALUES,CONFIDENCE_TEXT_VALUES,DEPENDENCY_KIND_VALUES,ISSUE_SEVERITY_VALUES,ITEM_TYPE_VALUES,RISK_VALUES,STATUS_VALUES}from"../types/index.js";const ACTIVE_EXTENSION_HOST_CONTEXT=Symbol("pm.active-extension-host-context");function splitFullClientMutationOptions(options){return{fullChangedFields:!0,options}}class PmClient{defaults;constructor(options={}){this.defaults={...options.pmRoot===void 0?{}:{path:options.pmRoot},...options.cwd===void 0?{}:{cwd:options.cwd},...options.author===void 0?{}:{author:options.author},...options.noExtensions===void 0?{}:{noExtensions:options.noExtensions}}}static forActiveExtensionHost(options){const client=new PmClient({...options,noExtensions:!0});return client.defaults[ACTIVE_EXTENSION_HOST_CONTEXT]=!0,client}run(action,args={}){return runAction({...this.defaults,...args,action})}runTyped(action,args={}){return this.run(action,args)}async withItemTransactionContext(run,configurationOnly=!1){const pmRoot=resolvePmRoot(this.defaults.cwd??process.cwd(),this.defaults.path),execute=async()=>{const settings=await runWithConfigurationOnlySettings(pmRoot,()=>readSettings(pmRoot));return run({pmRoot,author:resolveAuthor(this.defaults.author,settings.author_default)})};if(this.defaults[ACTIVE_EXTENSION_HOST_CONTEXT]===!0||activeExtensionScope.getStore()===!0)return execute();const activate=()=>runWithActiveExtensions({...this.defaults,path:pmRoot},execute);return configurationOnly?runWithConfigurationOnlySettings(pmRoot,activate):activate()}previewItemMutations(options){return this.withItemTransactionContext(async identity=>(await import("./item-transaction.js")).previewItemMutations({...options,...identity}),!0)}commitItemMutations(options){return this.withItemTransactionContext(async identity=>(await import("./item-transaction.js")).commitItemMutations({...options,...identity}))}get itemTransactions(){const abandon=(transactionId,options)=>this.withItemTransactionContext(async identity=>(await import("./item-transaction.js")).abandonItemTransaction({...options,...identity,transactionId}));return{status:transactionId=>this.withItemTransactionContext(async identity=>(await import("./item-transaction.js")).readItemTransaction(identity.pmRoot,transactionId),!0),abandon,supersede:(transactionId,newId,options)=>abandon(transactionId,{...options,supersededBy:newId})}}readItemRevision(id){return this.withItemTransactionContext(async({pmRoot})=>(await import("./lifecycle/item-revision.js")).readItemRevision(id,{pmRoot}))}async withExpectedItemRevisions(expectations,operation){const revisions=await import("./lifecycle/item-revision.js"),scope=await this.withItemTransactionContext(({pmRoot})=>revisions.bindExpectedItemRevisions(expectations,{pmRoot}));return revisions.runWithBoundItemRevisionScope(scope,operation)}context(options={}){return this.runTyped("context",{options})}listAllItemMetadataLight(){return listClientItemMetadataLight(this.defaults.path,this.defaults.cwd)}list(options={}){return this.runTyped("list",{options})}async listAllComplete(options={}){return certifyCompleteListResult(await this.list(createCompleteListOptions(options)))}search(query,options={}){return this.runTyped("search",{query,options})}get(id,options={}){return this.runTyped("get",{id,options})}next(options={}){return this.runTyped("next",{options})}aggregate(options={}){return this.runTyped("aggregate",{options})}stats(options={}){return this.runTyped("stats",{options})}duplicates(options={}){return this.runTyped("duplicates",{options})}comments(id,options={}){return this.runTyped("comments",{id,options})}notes(id,options={}){return this.runTyped("notes",{id,options})}learnings(id,options={}){return this.runTyped("learnings",{id,options})}files(id,options={}){return this.runTyped("files",{id,options})}filesDiscover(id,options={}){return this.runTyped("files-discover",{id,options})}filesLookup(options){return this.runTyped("files-lookup",{options})}docs(id,options={}){return this.runTyped("docs",{id,options})}deps(id,options={}){return this.runTyped("deps",{id,options})}graph(subcommand,ids={},options={}){return this.runTyped("graph",{subcommand,...ids,options})}async append(id,body,options={}){return assertMutationOptionBag(options,"append"),await this.runTyped("append",{id,...splitFullClientMutationOptions(mutationOptionsWithOverrides(options,{body}))})}init(prefix,options={}){return this.runTyped("init",{...prefix===void 0?{}:{prefix},options})}config(scope,configAction,key,value,options={}){return this.runTyped("config",{scope,configAction,...key===void 0?{}:{key},...value===void 0?{}:{value},options})}schema(subcommand,options={}){return this.runTyped("schema",{options:{...options,subcommand}})}workflowPolicy(action,name,options={}){return this.runTyped("schema",{name,options:{...options,subcommand:action}})}schemaList(){return this.runTyped("schema",{options:{subcommand:"list"}})}schemaShow(name){return this.runTyped("schema",{name,options:{subcommand:"show"}})}schemaAddType(name,options={}){return this.runTyped("schema",{name,options:{...options,subcommand:"add-type"}})}schemaRemoveType(name,options={}){return this.runTyped("schema",{name,options:{...options,subcommand:"remove-type"}})}schemaAddStatus(name,options={}){return this.runTyped("schema",{name,options:{...options,subcommand:"add-status"}})}schemaRemoveStatus(name,options={}){return this.runTyped("schema",{name,options:{...options,subcommand:"remove-status"}})}schemaAddField(name,options={}){const{type,...mutationOptions}=options;return this.runTyped("schema",{name,options:{...mutationOptions,fieldType:type,subcommand:"add-field"}})}schemaRemoveField(name,options={}){return this.runTyped("schema",{name,options:{...options,subcommand:"remove-field"}})}schemaListFields(){return this.runTyped("schema",{options:{subcommand:"list-fields"}})}schemaShowField(name){return this.runTyped("schema",{name,options:{subcommand:"show-field"}})}schemaApplyPreset(typePreset,options={}){return this.runTyped("schema",{typePreset,options:{...options,subcommand:"apply-preset"}})}schemaInferTypes(options={}){return this.runTyped("schema",{options:{...options,subcommand:"add-type",infer:!0}})}schemaRenameType(from,to,options){return this.runTyped("schema",{name:from,options:{...options,subcommand:"rename-type",to}})}schemaRenameField(from,to,options,type){return this.runTyped("schema",{name:from,options:{...options,subcommand:"rename-field",to,...type?{fieldTypeScope:type}:{}}})}schemaRemapStatus(from,to,options){return this.runTyped("schema",{name:from,options:{...options,subcommand:"remap-status",to}})}schemaShowStatus(name){return this.runTyped("schema",{name,options:{subcommand:"show-status"}})}profile(subcommand,options={}){return this.runTyped("profile",{options:{...options,subcommand}})}profileList(){return this.runTyped("profile",{options:{subcommand:"list"}})}profileShow(name){return this.runTyped("profile",{name,options:{subcommand:"show"}})}profileApply(name,options={}){return this.runTyped("profile",{name,options:{...options,subcommand:"apply"}})}profileLint(name){return this.runTyped("profile",{name,options:{subcommand:"lint"}})}validate(options={}){return this.runTyped("validate",{options})}health(options={}){return this.runTyped("health",{options})}gc(options={}){return this.runTyped("gc",{options})}assurance(input){return this.runTyped("assurance",{options:{...input,subcommand:input.action}})}historyRedact(id,options){return this.runTyped("history-redact",{id,options})}historyRepair(id,options={}){return this.runTyped("history-repair",{id,options})}historyRepairAll(options={}){return this.runTyped("history-repair",{options:{...options,all:!0}})}historyAttest(options={}){return this.runTyped("history-attest",{options})}historyCompact(id,options={}){return this.runTyped("history-compact",{id,options})}historyCompactBulk(options){return this.runTyped("history-compact",{options})}historyAuthorAcknowledge(options){return this.runTyped("history-author-acknowledge",{historyEvent:(options.events??[]).map(event=>`${event.item_id}:${String(event.line)}`),allActionable:options.all_actionable===!0,dryRun:options.dry_run===!0,planFingerprint:options.plan_fingerprint,limit:options.coordinate_limit,attributedAuthor:options.attributed_author,reviewer:options.reviewer,reason:options.reason})}plan(subcommand,id,options={},stepRef,reorderTo){return this.runTyped("plan",{fullChangedFields:!0,...id===void 0?{}:{id},...stepRef===void 0?{}:{stepRef},...reorderTo===void 0?{}:{reorderTo},options:mutationOptionsWithOverrides(options,{subcommand})})}planCreate(options){return this.plan("create",void 0,options)}planShow(id,options={}){return this.plan("show",id,options)}planAddStep(id,options){return this.plan("add-step",id,options)}planUpdateStep(id,stepRef,options){return this.plan("update-step",id,options,stepRef)}planCompleteStep(id,stepRef,options={}){return this.plan("complete-step",id,options,stepRef)}planBlockStep(id,stepRef,options){return this.plan("block-step",id,options,stepRef)}planReorderStep(id,stepRef,reorderTo,options={}){return this.plan("reorder-step",id,options,stepRef,reorderTo)}planRemoveStep(id,stepRef,options={}){return this.plan("remove-step",id,options,stepRef)}planLink(id,stepRef,options){return this.plan("link",id,options,stepRef)}planUnlink(id,stepRef,options){return this.plan("unlink",id,options,stepRef)}planDecision(id,options){return this.plan("decision",id,options)}planDiscovery(id,options){return this.plan("discovery",id,options)}planValidation(id,options){return this.plan("validation",id,options)}planResume(id,options){return this.plan("resume",id,options)}planApprove(id,options={}){return this.plan("approve",id,options)}planMaterialize(id,options){return this.plan("materialize",id,options)}create(options={}){return this.runTyped("create",splitFullClientMutationOptions(options))}update(id,options={}){return this.runTyped("update",{id,...splitFullClientMutationOptions(options)})}reopen(id,reason,options={}){return this.runTyped("item-reopen",{id,reason,fullChangedFields:!0,options})}close(id,reason,options={}){return this.runTyped("close",{id,reason,...splitFullClientMutationOptions(options)})}claim(id,options={}){return this.runTyped("claim",{id,...splitFullClientMutationOptions(options)})}claimNext(options={}){return this.runTyped("claim",{next:!0,...splitFullClientMutationOptions(options)})}release(id,options={}){return this.runTyped("release",{id,...splitFullClientMutationOptions(options)})}copy(id,options={}){return this.runTyped("copy",{id,...splitFullClientMutationOptions(options)})}delete(id,options={}){return this.runTyped("delete",{id,...splitFullClientMutationOptions(options)})}restore(id,target,options={}){return this.runTyped("restore",{fullChangedFields:!0,id,options:{...options,target}})}focus(id,options={}){return this.runTyped("focus",{...id===void 0?{}:{id},...splitFullClientMutationOptions(options)})}startTask(id,options={}){return this.runTyped("start-task",{id,...splitFullClientMutationOptions(options)})}pauseTask(id,options={}){return this.runTyped("pause-task",{id,...splitFullClientMutationOptions(options)})}closeTask(id,reason,options={}){return this.runTyped("close-task",{id,reason,...splitFullClientMutationOptions(options)})}extension(target,options={}){return this.runTyped("extension",{...target===void 0?{}:{target},options})}extensionList(options={}){return this.extension("list",options)}extensionActivate(target,options={}){return this.runTyped("extension-activate",{target,options})}extensionDeactivate(target,options={}){return this.runTyped("extension-deactivate",{target,options})}package(target,options={}){return this.runTyped("package",{...target===void 0?{}:{target},options:{...options,vocabulary:"package"}})}packageList(options={}){return this.package("list",options)}packageInstall(target,options={}){return this.runTyped("package-install",{target,options})}packageUninstall(target,options={}){return this.runTyped("package-uninstall",{target,options})}packageDoctor(options={}){return this.runTyped("package-doctor",{options})}packageManage(target,options={}){return this.runTyped("package-manage",{...target===void 0?{}:{target},options})}packageDescribe(target,options={}){return this.runTyped("package-describe",{...target===void 0?{}:{target},options})}packageReload(options={}){return this.runTyped("package-reload",{options})}packageCatalog(options={}){return this.runTyped("package-catalog",{options})}packageActivate(target,options={}){return this.runTyped("package-activate",{target,options})}packageDeactivate(target,options={}){return this.runTyped("package-deactivate",{target,options})}packageMigrate(options={}){return this.package(void 0,{...options,migrate:!0})}upgrade(target,options={}){return this.runTyped("upgrade",{...target===void 0?{}:{target},options})}}function context(options={},clientOptions={}){return new PmClient(clientOptions).context(options)}function list(options={},clientOptions={}){return new PmClient(clientOptions).list(options)}function listAllComplete(options={},clientOptions={}){return new PmClient(clientOptions).listAllComplete(options)}function search(query,options={},clientOptions={}){return new PmClient(clientOptions).search(query,options)}function get(id,options={},clientOptions={}){return new PmClient(clientOptions).get(id,options)}function next(options={},clientOptions={}){return new PmClient(clientOptions).next(options)}function aggregate(options={},clientOptions={}){return new PmClient(clientOptions).aggregate(options)}function stats(options={},clientOptions={}){return new PmClient(clientOptions).stats(options)}function duplicates(options={},clientOptions={}){return new PmClient(clientOptions).duplicates(options)}function comments(id,options={},clientOptions={}){return new PmClient(clientOptions).comments(id,options)}function notes(id,options={},clientOptions={}){return new PmClient(clientOptions).notes(id,options)}function learnings(id,options={},clientOptions={}){return new PmClient(clientOptions).learnings(id,options)}function files(id,options={},clientOptions={}){return new PmClient(clientOptions).files(id,options)}function filesDiscover(id,options={},clientOptions={}){return new PmClient(clientOptions).filesDiscover(id,options)}function filesLookup(options,clientOptions={}){return new PmClient(clientOptions).filesLookup(options)}function docs(id,options={},clientOptions={}){return new PmClient(clientOptions).docs(id,options)}function deps(id,options={},clientOptions={}){return new PmClient(clientOptions).deps(id,options)}function graph(subcommand,ids={},options={},clientOptions={}){return new PmClient(clientOptions).graph(subcommand,ids,options)}function append(id,body,options={},clientOptions={}){return new PmClient(clientOptions).append(id,body,options)}function init(prefix,options={},clientOptions={}){return new PmClient(clientOptions).init(prefix,options)}function config(scope,configAction,key,value,options={},clientOptions={}){return new PmClient(clientOptions).config(scope,configAction,key,value,options)}function schema(subcommand,options={},clientOptions={}){return new PmClient(clientOptions).schema(subcommand,options)}function schemaList(clientOptions={}){return new PmClient(clientOptions).schemaList()}function schemaShow(name,clientOptions={}){return new PmClient(clientOptions).schemaShow(name)}function schemaAddType(name,options={},clientOptions={}){return new PmClient(clientOptions).schemaAddType(name,options)}function schemaRemoveType(name,options={},clientOptions={}){return new PmClient(clientOptions).schemaRemoveType(name,options)}function schemaAddStatus(name,options={},clientOptions={}){return new PmClient(clientOptions).schemaAddStatus(name,options)}function schemaRemoveStatus(name,options={},clientOptions={}){return new PmClient(clientOptions).schemaRemoveStatus(name,options)}function schemaAddField(name,options={},clientOptions={}){return new PmClient(clientOptions).schemaAddField(name,options)}function schemaRemoveField(name,options={},clientOptions={}){return new PmClient(clientOptions).schemaRemoveField(name,options)}function schemaListFields(clientOptions={}){return new PmClient(clientOptions).schemaListFields()}function schemaShowField(name,clientOptions={}){return new PmClient(clientOptions).schemaShowField(name)}function schemaApplyPreset(typePreset,options={},clientOptions={}){return new PmClient(clientOptions).schemaApplyPreset(typePreset,options)}function schemaInferTypes(options={},clientOptions={}){return new PmClient(clientOptions).schemaInferTypes(options)}function schemaRenameType(from,to,options,clientOptions={}){return new PmClient(clientOptions).schemaRenameType(from,to,options)}function schemaRenameField(from,to,options,type,clientOptions={}){return new PmClient(clientOptions).schemaRenameField(from,to,options,type)}function schemaRemapStatus(from,to,options,clientOptions={}){return new PmClient(clientOptions).schemaRemapStatus(from,to,options)}function schemaShowStatus(name,clientOptions={}){return new PmClient(clientOptions).schemaShowStatus(name)}function profile(subcommand,options={},clientOptions={}){return new PmClient(clientOptions).profile(subcommand,options)}function profileList(clientOptions={}){return new PmClient(clientOptions).profileList()}function profileShow(name,clientOptions={}){return new PmClient(clientOptions).profileShow(name)}function profileApply(name,options={},clientOptions={}){return new PmClient(clientOptions).profileApply(name,options)}function profileLint(name,clientOptions={}){return new PmClient(clientOptions).profileLint(name)}function validate(options={},clientOptions={}){return new PmClient(clientOptions).validate(options)}function health(options={},clientOptions={}){return new PmClient(clientOptions).health(options)}function gc(options={},clientOptions={}){return new PmClient(clientOptions).gc(options)}function historyRedact(id,options,clientOptions={}){return new PmClient(clientOptions).historyRedact(id,options)}function historyRepair(id,options={},clientOptions={}){return new PmClient(clientOptions).historyRepair(id,options)}function historyRepairAll(options={},clientOptions={}){return new PmClient(clientOptions).historyRepairAll(options)}function historyCompact(id,options={},clientOptions={}){return new PmClient(clientOptions).historyCompact(id,options)}function historyCompactBulk(options,clientOptions={}){return new PmClient(clientOptions).historyCompactBulk(options)}function create(options={},clientOptions={}){return new PmClient(clientOptions).create(options)}function update(id,options={},clientOptions={}){return new PmClient(clientOptions).update(id,options)}function reopen(id,reason,options={},clientOptions={}){return new PmClient(clientOptions).reopen(id,reason,options)}function close(id,reason,options={},clientOptions={}){return new PmClient(clientOptions).close(id,reason,options)}function claim(id,options={},clientOptions={}){return new PmClient(clientOptions).claim(id,options)}function claimNext(options={},clientOptions={}){return new PmClient(clientOptions).claimNext(options)}function release(id,options={},clientOptions={}){return new PmClient(clientOptions).release(id,options)}function copy(id,options={},clientOptions={}){return new PmClient(clientOptions).copy(id,options)}function deleteItem(id,options={},clientOptions={}){return new PmClient(clientOptions).delete(id,options)}function restore(id,target,options={},clientOptions={}){return new PmClient(clientOptions).restore(id,target,options)}function focus(id,options={},clientOptions={}){return new PmClient(clientOptions).focus(id,options)}function startTask(id,options={},clientOptions={}){return new PmClient(clientOptions).startTask(id,options)}function pauseTask(id,options={},clientOptions={}){return new PmClient(clientOptions).pauseTask(id,options)}function closeTask(id,reason,options={},clientOptions={}){return new PmClient(clientOptions).closeTask(id,reason,options)}function extension(target,options={},clientOptions={}){return new PmClient(clientOptions).extension(target,options)}function extensionList(options={},clientOptions={}){return new PmClient(clientOptions).extensionList(options)}function extensionActivate(target,options={},clientOptions={}){return new PmClient(clientOptions).extensionActivate(target,options)}function extensionDeactivate(target,options={},clientOptions={}){return new PmClient(clientOptions).extensionDeactivate(target,options)}function packageLifecycle(target,options={},clientOptions={}){return new PmClient(clientOptions).package(target,options)}function packageList(options={},clientOptions={}){return new PmClient(clientOptions).packageList(options)}function packageInstall(target,options={},clientOptions={}){return new PmClient(clientOptions).packageInstall(target,options)}function packageUninstall(target,options={},clientOptions={}){return new PmClient(clientOptions).packageUninstall(target,options)}function packageDoctor(options={},clientOptions={}){return new PmClient(clientOptions).packageDoctor(options)}function packageManage(target,options={},clientOptions={}){return new PmClient(clientOptions).packageManage(target,options)}function packageDescribe(target,options={},clientOptions={}){return new PmClient(clientOptions).packageDescribe(target,options)}function packageReload(options={},clientOptions={}){return new PmClient(clientOptions).packageReload(options)}function packageCatalog(options={},clientOptions={}){return new PmClient(clientOptions).packageCatalog(options)}function packageActivate(target,options={},clientOptions={}){return new PmClient(clientOptions).packageActivate(target,options)}function packageDeactivate(target,options={},clientOptions={}){return new PmClient(clientOptions).packageDeactivate(target,options)}function upgrade(target,options={},clientOptions={}){return new PmClient(clientOptions).upgrade(target,options)}async function getContracts(pmRootOrOptions,options={}){const resolvedOptions=typeof pmRootOrOptions=="string"?{...options,pmRoot:pmRootOrOptions}:pmRootOrOptions??options,global2={json:!0,quiet:resolvedOptions.quiet??!0,noExtensions:resolvedOptions.noExtensions??!1,noPager:!0,profile:resolvedOptions.profile??!1,path:resolvedOptions.pmRoot};return runContracts(resolvedOptions,global2)}const extensionActivationGate=createAsyncReadWriteGate(),activeExtensionScope=new AsyncLocalStorage;function resetActiveExtensionRegistries(){setActiveExtensionHooks(createEmptyExtensionHookRegistry()),setActiveExtensionCommands(createEmptyExtensionCommandRegistry()),setActiveExtensionParsers(createEmptyExtensionParserRegistry()),setActiveExtensionPreflight(createEmptyExtensionPreflightRegistry()),setActiveExtensionServices(createEmptyExtensionServiceRegistry()),setActiveExtensionRenderers(createEmptyExtensionRendererRegistry()),setActiveExtensionRegistrations(createEmptyExtensionRegistrationRegistry())}async function withActiveExtensions(global2,explicitCwd,resolutionCwd,run){return runWithIsolatedExtensionRuntime(()=>explicitCwd===void 0?extensionActivationGate.read(()=>withActiveExtensionsExclusively(global2,resolutionCwd,run)):extensionActivationGate.write(()=>withCwd(explicitCwd,()=>withActiveExtensionsExclusively(global2,resolutionCwd,run))))}async function runWithActiveExtensions(options,run){const explicitCwd=options.cwd;if(activeExtensionScope.getStore()===!0&&explicitCwd===void 0&&options.noExtensions===!0){const pmRoot=resolvePmRoot(process.cwd(),options.path);return runWithIsolatedExtensionRuntime(()=>runWithDiscoveredContextIntentContracts({pmRoot},run))}const resolutionCwd=explicitCwd??process.cwd();return withActiveExtensions(globalOptions({path:options.path,noExtensions:options.noExtensions}),explicitCwd,resolutionCwd,()=>activeExtensionScope.run(!0,run))}function describeActivationFailure(error){try{const stack=error instanceof Error?error.stack:void 0,description=typeof stack=="string"?stack:describeUnknownError(error);return typeof description=="string"?description:"Unknown failure"}catch{return"Unknown failure"}}async function withActiveExtensionsExclusively(global2,cwd,run){const pmRoot=resolvePmRoot(cwd,global2.path);if(global2.noExtensions)return resetActiveExtensionRegistries(),runWithDiscoveredContextIntentContracts({pmRoot},()=>run(null));if(!await pathExists(getSettingsPath(pmRoot)))return resetActiveExtensionRegistries(),run(null);let active=null,activated;try{const settings=await readSettings(pmRoot),loadResult=await loadExtensions({pmRoot,settings,cwd,noExtensions:!1}),activationResult=await activateExtensions({...loadResult,loaded:loadResult.loaded});activated={loadResult,activationResult},setActiveExtensionHooks(activationResult.hooks),setActiveExtensionCommands(activationResult.commands),setActiveExtensionParsers(activationResult.parsers),setActiveExtensionPreflight(activationResult.preflight),setActiveExtensionServices(activationResult.services),setActiveExtensionRenderers(activationResult.renderers),setActiveExtensionRegistrations(activationResult.registrations),active={registrations:activationResult.registrations,commands:activationResult.commands,pmRoot,packages:loadResult.loaded}}catch(error){resetActiveExtensionRegistries(),console.error("[pm-sdk] extension activation failed; continuing without active extensions:",describeActivationFailure(error))}try{return await runWithDiscoveredContextIntentContracts({pmRoot,packages:active?.packages},()=>run(active))}finally{resetActiveExtensionRegistries(),activated&&await deactivateExtensions(activated.loadResult,activated.activationResult).catch(()=>{})}}function resolveActiveExtensionActionCommand(action,active){const normalizedAction=normalizeActionName(action);return active?.registrations.commands.find(entry=>normalizeActionName(entry.action)===normalizedAction)?.command??active?.commands.handlers.find(entry=>normalizeActionName(entry.command)===normalizedAction)?.command}async function dispatchActiveExtensionAction(action,args,options,global2,active){if(!active)throw new PmCliError(`Unsupported native pm action: ${action}`,EXIT_CODE.USAGE);const command=resolveActiveExtensionActionCommand(action,active);if(!command)throw new PmCliError(`Unsupported native pm action: ${action}`,EXIT_CODE.USAGE);const extensionAuthor=typeof options.author=="string"?options.author:global2.author,handlerResult=await runActiveCommandHandler({command:normalizeCommandPath(command),args:readStringArray(options.args??args.args),options:extensionOptionsFromArgs(args,options),global:{...global2,author:extensionAuthor},pm_root:active.pmRoot,sdk:createExtensionCommandSdk(active.pmRoot,PmClient.forActiveExtensionHost({pmRoot:active.pmRoot,author:extensionAuthor}),extensionAuthor,normalizeCommandPath(command))});if(!handlerResult.handled){if(Object.hasOwn(handlerResult,"cause"))throw createExtensionCommandError(command,handlerResult);const suffix=handlerResult.warnings.length>0?` (${handlerResult.warnings.join(", ")})`:"";throw new PmCliError(`Unsupported native pm action: ${action}${suffix}`,EXIT_CODE.USAGE)}return handlerResult.result}async function withCwd(cwd,run){const previous=process.cwd();process.chdir(cwd);try{return await run()}finally{process.chdir(previous)}}function resolveSdkActionInput(args){const rawAction=readRequiredString(args,"action"),normalizedAction=normalizeActionName(rawAction),alias=getOwnHandler(SDK_ACTION_ALIASES,normalizedAction),action=alias?.action??normalizedAction,resolvedArgs={...args,action};return alias?.options!==void 0&&(resolvedArgs.options={...alias.options,...asRecordClone(args.options)}),action==="package"&&(resolvedArgs.options={...asRecordClone(resolvedArgs.options),vocabulary:"package"}),{action,args:resolvedArgs}}async function runAction(args){const resolved=resolveSdkActionInput(args),global2=globalOptions(resolved.args);capturePmCommandScope(global2);const invalidateWorkspaceContractsCache=shouldInvalidateWorkspaceContractsCacheAfterAction(resolved.action),explicitCwd=readString(resolved.args,"cwd"),resolutionCwd=explicitCwd??process.cwd();resolved.action==="init"&&(global2[INIT_INVOCATION_CWD]=resolutionCwd),(resolved.action!=="init"||global2.path!==void 0||(process.env.PM_PATH?.trim().length??0)>0)&&(global2.path=resolvePmRoot(resolutionCwd,global2.path));const{expectHash,dispatchArgs}=splitExpectHashInput(resolved.args),dispatch=async activeExtensions=>{if(expectHash===void 0)return dispatchAction(resolved.action,dispatchArgs,global2,activeExtensions);const{dispatchWithExpectedItemRevisions}=await import("./lifecycle/item-revision.js");return dispatchWithExpectedItemRevisions({action:resolved.action,expectHash,defaultId:readString(dispatchArgs,"id")??readString(asRecordClone(dispatchArgs.options),"id"),options:asRecordClone(dispatchArgs.options),background:dispatchArgs.background,pmRoot:resolvePmRoot(resolutionCwd,global2.path),run:()=>dispatchAction(resolved.action,dispatchArgs,global2,activeExtensions)})};try{return resolved.action==="history-attest"?await dispatch(null):args[ACTIVE_EXTENSION_HOST_CONTEXT]===!0||activeExtensionScope.getStore()===!0?await dispatch(null):await withActiveExtensions(global2,explicitCwd,resolutionCwd,activeExtensions=>dispatch(activeExtensions))}finally{invalidateWorkspaceContractsCache&&clearWorkspaceContractsCache()}}function analyzeSdkActionCoverage(actions=PM_TOOL_ACTIONS){return actions.map(action=>{const normalized=normalizeActionName(action),alias=getOwnHandler(SDK_ACTION_ALIASES,normalized),resolvedAction=alias?.action??normalized,covered=getOwnHandler(SDK_ACTION_HANDLERS,resolvedAction)!==void 0;return{action,resolved_action:resolvedAction,covered,route:covered?alias?"alias":"native":"missing"}})}async function dispatchAction(action,args,global2,activeExtensions){const options=optionsWithAuthor(args,action);if(action==="create"||action==="update"){const{assertNativeMutationOptions}=await import("./runtime/mutation-admission.js");await assertNativeMutationOptions(action,args,options,global2.path,HOISTED_ACTION_OPTION_KEYS[action])}const handler=getOwnHandler(SDK_ACTION_HANDLERS,action),extensionCommand=handler?void 0:resolveActiveExtensionActionCommand(action,activeExtensions),readCommand=extensionCommand===void 0?action:`extension:${extensionCommand}`;validateReadOutputOptions(readCommand,options),normalizeReadOutputIncludeModeOptions(readCommand,options);const ctx={action,args,options,id:readString(args,"id"),force:args.force===!0||options.force===!0,global:global2,activeExtensions},result=handler?await handler(ctx):await dispatchActiveExtensionAction(action,args,options,global2,activeExtensions);if(action==="history-attest")return result;{const projected=attachReadOutputContracts(readCommand,options,result);return await finalizeContextUsageEgress(resolvePmRoot(process.cwd(),global2.path),projected),projected}}const actionRunnerTestHooks={closeManyOptionsFromFlat,extensionOptionsFromArgs,globalOptions,mutationListOptions,normalizeActionName,normalizeCommandPath,normalizeMcpUpdateOptions,normalizeMcpOptionsArrays,optionsWithAuthor,readRequiredString,readScalarString,readScalarStringAllowBlank,readStringArray,updateManyOptionsFromFlat,withAddNoteOption,withFilesDiscoveryOptions,withMutationCompaction};(process.env.NODE_ENV==="test"||process.env.VITEST!==void 0||process.env.VITEST_WORKER_ID!==void 0)&&(globalThis.__pmCliActionRunnerTestHooks=actionRunnerTestHooks);import{readRequiredString as readRequiredString2}from"./runtime/context.js";export{BASELINE_ITEM_FORMAT_VERSION,BUILTIN_ITEM_TYPE_VALUES,CONFIDENCE_TEXT_VALUES,CONTEXT_OUTPUT_VALUES,CURRENT_ITEM_FORMAT_VERSION,DEFAULT_TERMINAL_TRANSITION_POLICY,DEPENDENCY_KIND_VALUES,EXIT_CODE,HISTORY_EVENT_CLASSIFICATION_VERSION,ISSUE_SEVERITY_VALUES,ITEM_TYPE_VALUES,MAINTENANCE_HISTORY_OPERATIONS,NEXT_OUTPUT_VALUES,PM_CLI_ERROR_DETAILS_LIMITS,PM_CLI_EXPECTED_ERROR_NAME,PM_GITIGNORE_END,PM_GITIGNORE_START,PmCliError2 as PmCliError,PmClient,PmCompleteListValidationError,RISK_VALUES,SEARCH_EXTENSION_FLAG_DEFINITIONS,STATUS_VALUES,SUBSTANTIVE_HISTORY_OPERATIONS,acquireLock,acquireLockLease,aggregate,analyzeSdkActionCoverage,append,appendHistoryEntry,applyTerminalOrderingPolicy,assertCompleteListResult,canonicalDocument,certifyCompleteListResult2 as certifyCompleteListResult,claim,claimNext,classifyHistoryEvent,classifyItemFormatVersion,clearWorkspaceContractsCache2 as clearWorkspaceContractsCache,close,closeItem,closeTask,comments,commitImportedItem,config,context,copy,create,createCompleteListOptions2 as createCompleteListOptions,createHistoryEntry,createPmCliExpectedError,deleteItem,deps,docs,duplicates,effectiveItemFormatVersion,emptyImportedDocument,ensurePmGitignore,ensureTrackerInitialized,extension,extensionActivate,extensionDeactivate,extensionList,files,filesDiscover,filesLookup,focus,gc,generateItemId,get,getActiveExtensionRegistrations,getContracts,getHistoryPath,getItemPath,getPmGitignoreBlock,getSettingsPath2 as getSettingsPath,getWorkspaceContracts,graph,health,historyCompact,historyCompactBulk,historyRedact,historyRepair,historyRepairAll,init,inspectCompleteListResult,isPmCliErrorDetails,isPmCliExpectedError,isTerminalStatus,isTimestampLiteral,jaccardSimilarity,learnings,list,listAllComplete,listAllItemMetadata,listAllItemMetadataLight,loadCreateTemplateOptions,locateItem,next,normalizeItemFormatVersion,normalizeItemId,normalizeItemMetadata,normalizeRawItemId,normalizeSimilarityText,normalizeStatusInput,notes,nowIso,packageActivate,packageCatalog,packageDeactivate,packageDescribe,packageDoctor,packageInstall,packageLifecycle,packageList,packageManage,packageReload,packageUninstall,parseTags,pathExists2 as pathExists,pauseTask,profile,profileApply,profileLint,profileList,profileShow,projectPmCliErrorContextDetails,projectPmCliErrorDetails,readBooleanOption,readCsvListOption,readFileIfExists,readLocatedItem,readRequiredString2 as readRequiredString,readSettings2 as readSettings,readStringOption,release,removeFileIfExists,renderCalendarMarkdown,renderCalendarToon,renderGuideMarkdown,reopen,requireTerminalReason,resolveCalendarOutputFormat,resolveGuideOutputFormat,resolveImplicitPmRoot,resolveItemTypeRegistry,resolvePmRoot2 as resolvePmRoot,resolveRuntimeFieldRegistry,resolveRuntimeStatusRegistry,resolveTerminalReason,restore,runAction,runActiveOnReadHooks,runActiveOnWriteHooks,runAggregate,runCalendar,runClose,runCloseTask,runCompletion,runContext,runCopy,runDelete,runDuplicates,runFocus,runGet,runGuide,runList,runNext,runPauseTask,runReindex,runReopen,runRestore,runSearch,runStartTask,runStats,runTemplatesList,runTemplatesSave,runTemplatesShow,runTestRunsList,runTestRunsLogs,runTestRunsResume,runTestRunsStatus,runTestRunsStop,runUpdate,runWithActiveExtensions,scanItemFormatVersions,schema,schemaAddField,schemaAddStatus,schemaAddType,schemaApplyPreset,schemaInferTypes,schemaList,schemaListFields,schemaRemapStatus,schemaRemoveField,schemaRemoveStatus,schemaRemoveType,schemaRenameField,schemaRenameType,schemaShow,schemaShowField,schemaShowStatus,scoreItemSimilarity,search,selectImportAuthor,serializeItemDocument,snapshotPmCliErrorContext,splitFrontMatter,startTask,stats,toEstimatedMinutesValue,toImportBoolean,toImportConfidence,toImportInteger,toImportLinkedDocs,toImportLinkedFiles,toImportLinkedTests,toImportLogEntries,toImportNormalizedEnum,toImportNumberMap,toImportPriority,toImportStatus,toImportStringList,toImportStringMap,toImportTags,toNonEmptyImportString,tokenizeSimilarityText,update,upgrade,validate,withCliMutationInput,withLiteralMutationInput,writeFileAtomic};
1
+ (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="4bde11af-4f29-5ea2-97e1-6c7fd8b762de")}catch{}})();import{AsyncLocalStorage}from"node:async_hooks";import{describeUnknownError,createExtensionCommandError}from"./error-runtime.js";import{capturePmCommandScope,resolvePmCommandScopeArgs}from"./command-line.js";import{createEmptyExtensionCommandRegistry,createEmptyExtensionHookRegistry,createEmptyExtensionParserRegistry,createEmptyExtensionPreflightRegistry,createEmptyExtensionRegistrationRegistry,createEmptyExtensionRendererRegistry,createEmptyExtensionServiceRegistry}from"../core/extensions/extension-registries.js";import{activateExtensions,deactivateExtensions,loadExtensions,runActiveCommandHandler,runWithIsolatedExtensionRuntime,setActiveExtensionCommands,setActiveExtensionHooks,setActiveExtensionParsers,setActiveExtensionPreflight,setActiveExtensionRegistrations,setActiveExtensionRenderers,setActiveExtensionServices}from"../core/extensions/index.js";import{pathExists}from"../core/fs/fs-utils.js";import{EXIT_CODE}from"../core/shared/constants.js";import{PmCliError}from"../core/shared/errors.js";import{asRecordClone}from"../core/shared/primitives.js";import{HOISTED_ACTION_OPTION_KEYS}from"./runtime-input.js";import{assertMutationOptionBag}from"./runtime/mutation-value-validation.js";import{withCliMutationInput,withLiteralMutationInput}from"./lifecycle/cli-input.js";import{createAsyncReadWriteGate}from"../core/shared/serial-queue.js";import{getSettingsPath,resolvePmRoot}from"../core/store/paths.js";import{readSettings,runWithConfigurationOnlySettings}from"../core/store/settings.js";import{resolveAuthor}from"../core/shared/author.js";import{PM_TOOL_ACTIONS}from"./cli-contracts/enum-contracts.js";import{runContracts}from"./cli-contracts/runtime-contracts.js";import{attachReadOutputContracts}from"./context-intent-contracts.js";import{runWithDiscoveredContextIntentContracts}from"./context-intent-runtime.js";import{finalizeContextUsageEgress}from"./context/usage-egress.js";import{createExtensionCommandSdk}from"./extension-command-context.js";import{INIT_INVOCATION_CWD}from"./init.js";import{certifyCompleteListResult,createCompleteListOptions}from"./query/complete-list.js";import{listClientItemMetadataLight}from"./query/light-metadata.js";import{normalizeReadOutputIncludeModeOptions,validateReadOutputOptions}from"./read-output-contracts.js";import{SDK_ACTION_ALIASES}from"./runtime-action-aliases.js";import{closeManyOptionsFromFlat,extensionOptionsFromArgs,actionGlobalOptions as globalOptions,mutationListOptions,mutationOptionsWithOverrides,normalizeActionName,normalizeCommandPath,normalizeMcpOptionsArrays,normalizeMcpUpdateOptions,optionsWithAuthor,readRuntimeScalarString as readScalarString,readRuntimeScalarStringAllowBlank as readScalarStringAllowBlank,readRuntimeString as readString,readRuntimeStringArray as readStringArray,shouldInvalidateWorkspaceContractsCacheAfterAction,splitExpectHashInput,updateManyOptionsFromFlat,withAddNoteOption,withFilesDiscoveryOptions,withMutationCompaction}from"./runtime-input.js";import{SDK_ACTION_HANDLERS}from"./runtime/actions.js";import{getOwnHandler,readRequiredString}from"./runtime/context.js";import{clearWorkspaceContractsCache}from"./workspace-contracts-cache.js";import{PM_GITIGNORE_END,PM_GITIGNORE_START,ensurePmGitignore,getPmGitignoreBlock}from"./workspace.js";import{SEARCH_EXTENSION_FLAG_DEFINITIONS}from"./extension-contracts.js";export*from"./cli-contracts/agent-output-contracts.js";import{PmCompleteListValidationError,assertCompleteListResult,certifyCompleteListResult as certifyCompleteListResult2,createCompleteListOptions as createCompleteListOptions2,inspectCompleteListResult}from"./query/complete-list.js";import{getWorkspaceContracts}from"./query/workspace-contracts.js";import{clearWorkspaceContractsCache as clearWorkspaceContractsCache2}from"./workspace-contracts-cache.js";export*from"./governance/workflow-policy.js";import{runCloseTask,runPauseTask,runStartTask}from"./lifecycle/task-composition.js";import{getActiveExtensionRegistrations,runActiveOnReadHooks,runActiveOnWriteHooks}from"../core/extensions/index.js";import{pathExists as pathExists2,readFileIfExists,removeFileIfExists,writeFileAtomic}from"../core/fs/fs-utils.js";import{appendHistoryEntry,createHistoryEntry}from"../core/history/history.js";import{HISTORY_EVENT_CLASSIFICATION_VERSION,MAINTENANCE_HISTORY_OPERATIONS,SUBSTANTIVE_HISTORY_OPERATIONS,classifyHistoryEvent}from"../core/history/event-classification.js";import{generateItemId,normalizeItemId,normalizeRawItemId}from"../core/item/id.js";import{readBooleanOption,readCsvListOption,readStringOption}from"./package-runtime-options.js";import{PM_CLI_ERROR_DETAILS_LIMITS,PM_CLI_EXPECTED_ERROR_NAME,createPmCliExpectedError,isPmCliErrorDetails,isPmCliExpectedError,projectPmCliErrorContextDetails,projectPmCliErrorDetails,snapshotPmCliErrorContext}from"./errors.js";import{commitImportedItem,emptyImportedDocument,ensureTrackerInitialized,selectImportAuthor,toEstimatedMinutesValue,toImportBoolean,toImportConfidence,toImportInteger,toImportLinkedDocs,toImportLinkedFiles,toImportLinkedTests,toImportLogEntries,toImportNormalizedEnum,toImportNumberMap,toImportPriority,toImportStatus,toImportStringList,toImportStringMap,toImportTags,toNonEmptyImportString}from"./package-import-adapters.js";import{canonicalDocument,normalizeItemMetadata,serializeItemDocument,splitFrontMatter}from"../core/item/item-format.js";import{BASELINE_ITEM_FORMAT_VERSION,CURRENT_ITEM_FORMAT_VERSION,classifyItemFormatVersion,effectiveItemFormatVersion,normalizeItemFormatVersion,scanItemFormatVersions}from"../core/item/item-format-version.js";import{parseTags}from"../core/item/parse.js";import{isTerminalStatus,normalizeStatusInput}from"../core/item/status.js";import{resolveItemTypeRegistry}from"../core/item/type-registry.js";import{acquireLock,acquireLockLease}from"../core/lock/lock.js";import{resolveRuntimeFieldRegistry,resolveRuntimeStatusRegistry}from"../core/schema/runtime-schema.js";import{PmCliError as PmCliError2}from"../core/shared/errors.js";import{isTimestampLiteral,nowIso}from"../core/shared/time.js";import{jaccardSimilarity,normalizeSimilarityText,scoreItemSimilarity,tokenizeSimilarityText}from"./similarity-scoring.js";import{listAllItemMetadata,listAllItemMetadataLight,locateItem,readLocatedItem}from"../core/store/item-store.js";import{getHistoryPath,getItemPath,getSettingsPath as getSettingsPath2,resolveImplicitPmRoot,resolvePmRoot as resolvePmRoot2}from"../core/store/paths.js";import{readSettings as readSettings2}from"../core/store/settings.js";import{runAggregate}from"./query/aggregate.js";import{CONTEXT_OUTPUT_VALUES,runContext}from"./query/context.js";import{runGet}from"./query/get.js";import{runList}from"./query/list.js";import{closeItem,runClose}from"./lifecycle/close.js";import{runCopy}from"./lifecycle/copy.js";import{runDelete}from"./lifecycle/delete.js";import{runFocus}from"./lifecycle/focus.js";import{runRestore}from"./lifecycle/restore.js";import{DEFAULT_TERMINAL_TRANSITION_POLICY,applyTerminalOrderingPolicy,requireTerminalReason,resolveTerminalReason}from"./lifecycle-policy.js";import{runUpdate}from"./lifecycle/update.js";import{runReopen}from"./lifecycle/reopen.js";import{NEXT_OUTPUT_VALUES,runNext}from"./query/next.js";import{runSearch}from"./query/search.js";import{runStats}from"./stats.js";import{runDuplicates}from"./duplicates.js";import{renderCalendarMarkdown,renderCalendarToon,resolveCalendarOutputFormat,runCalendar}from"./query/calendar.js";import{renderGuideMarkdown,resolveGuideOutputFormat,runGuide}from"./guide.js";import{runCompletion}from"./completion.js";import{runReindex}from"./governance/reindex.js";import{loadCreateTemplateOptions,runTemplatesList,runTemplatesSave,runTemplatesShow}from"./templates.js";import{runTestRunsList,runTestRunsLogs,runTestRunsResume,runTestRunsStatus,runTestRunsStop}from"./test/runs.js";import{BUILTIN_ITEM_TYPE_VALUES,CONFIDENCE_TEXT_VALUES,DEPENDENCY_KIND_VALUES,ISSUE_SEVERITY_VALUES,ITEM_TYPE_VALUES,RISK_VALUES,STATUS_VALUES}from"../types/index.js";const ACTIVE_EXTENSION_HOST_CONTEXT=Symbol("pm.active-extension-host-context");function splitFullClientMutationOptions(options){return{fullChangedFields:!0,options}}class PmClient{defaults;constructor(options={}){this.defaults={...options.pmRoot===void 0?{}:{path:options.pmRoot},...options.cwd===void 0?{}:{cwd:options.cwd},...options.author===void 0?{}:{author:options.author},...options.noExtensions===void 0?{}:{noExtensions:options.noExtensions}}}static forActiveExtensionHost(options){const client=new PmClient({...options,noExtensions:!0});return client.defaults[ACTIVE_EXTENSION_HOST_CONTEXT]=!0,client}run(action,args={}){return runAction({...this.defaults,...args,action})}runTyped(action,args={}){return this.run(action,args)}async withItemTransactionContext(run,configurationOnly=!1){const pmRoot=resolvePmRoot(this.defaults.cwd??process.cwd(),this.defaults.path),execute=async()=>{const settings=await runWithConfigurationOnlySettings(pmRoot,()=>readSettings(pmRoot));return run({pmRoot,author:resolveAuthor(this.defaults.author,settings.author_default)})};if(this.defaults[ACTIVE_EXTENSION_HOST_CONTEXT]===!0||activeExtensionScope.getStore()===!0)return execute();const activate=()=>runWithActiveExtensions({...this.defaults,path:pmRoot},execute);return configurationOnly?runWithConfigurationOnlySettings(pmRoot,activate):activate()}previewItemMutations(options){return this.withItemTransactionContext(async identity=>(await import("./item-transaction.js")).previewItemMutations({...options,...identity}),!0)}commitItemMutations(options){return this.withItemTransactionContext(async identity=>(await import("./item-transaction.js")).commitItemMutations({...options,...identity}))}get itemTransactions(){const abandon=(transactionId,options)=>this.withItemTransactionContext(async identity=>(await import("./item-transaction.js")).abandonItemTransaction({...options,...identity,transactionId}));return{status:transactionId=>this.withItemTransactionContext(async identity=>(await import("./item-transaction.js")).readItemTransaction(identity.pmRoot,transactionId),!0),abandon,supersede:(transactionId,newId,options)=>abandon(transactionId,{...options,supersededBy:newId})}}readItemRevision(id){return this.withItemTransactionContext(async({pmRoot})=>(await import("./lifecycle/item-revision.js")).readItemRevision(id,{pmRoot}))}async withExpectedItemRevisions(expectations,operation){const revisions=await import("./lifecycle/item-revision.js");let tracker="";const scope=await this.withItemTransactionContext(({pmRoot})=>(tracker=pmRoot,revisions.bindExpectedItemRevisions(expectations,{pmRoot}))),isolated=this.defaults.noExtensions===!0&&this.defaults[ACTIVE_EXTENSION_HOST_CONTEXT]!==!0;return revisions.runWithBoundItemRevisionScope(scope,operation,{scopeArgs:["--pm-path",tracker,...isolated?["--no-extensions"]:[]]})}context(options={}){return this.runTyped("context",{options})}listAllItemMetadataLight(){return listClientItemMetadataLight(this.defaults.path,this.defaults.cwd)}list(options={}){return this.runTyped("list",{options})}async listAllComplete(options={}){return certifyCompleteListResult(await this.list(createCompleteListOptions(options)))}search(query,options={}){return this.runTyped("search",{query,options})}get(id,options={}){return this.runTyped("get",{id,options})}next(options={}){return this.runTyped("next",{options})}aggregate(options={}){return this.runTyped("aggregate",{options})}stats(options={}){return this.runTyped("stats",{options})}duplicates(options={}){return this.runTyped("duplicates",{options})}comments(id,options={}){return this.runTyped("comments",{id,options})}notes(id,options={}){return this.runTyped("notes",{id,options})}learnings(id,options={}){return this.runTyped("learnings",{id,options})}files(id,options={}){return this.runTyped("files",{id,options})}filesDiscover(id,options={}){return this.runTyped("files-discover",{id,options})}filesLookup(options){return this.runTyped("files-lookup",{options})}docs(id,options={}){return this.runTyped("docs",{id,options})}deps(id,options={}){return this.runTyped("deps",{id,options})}graph(subcommand,ids={},options={}){return this.runTyped("graph",{subcommand,...ids,options})}async append(id,body,options={}){return assertMutationOptionBag(options,"append"),await this.runTyped("append",{id,...splitFullClientMutationOptions(mutationOptionsWithOverrides(options,{body}))})}init(prefix,options={}){return this.runTyped("init",{...prefix===void 0?{}:{prefix},options})}config(scope,configAction,key,value,options={}){return this.runTyped("config",{scope,configAction,...key===void 0?{}:{key},...value===void 0?{}:{value},options})}schema(subcommand,options={}){return this.runTyped("schema",{options:{...options,subcommand}})}workflowPolicy(action,name,options={}){return this.runTyped("schema",{name,options:{...options,subcommand:action}})}schemaList(){return this.runTyped("schema",{options:{subcommand:"list"}})}schemaShow(name){return this.runTyped("schema",{name,options:{subcommand:"show"}})}schemaAddType(name,options={}){return this.runTyped("schema",{name,options:{...options,subcommand:"add-type"}})}schemaRemoveType(name,options={}){return this.runTyped("schema",{name,options:{...options,subcommand:"remove-type"}})}schemaAddStatus(name,options={}){return this.runTyped("schema",{name,options:{...options,subcommand:"add-status"}})}schemaRemoveStatus(name,options={}){return this.runTyped("schema",{name,options:{...options,subcommand:"remove-status"}})}schemaAddField(name,options={}){const{type,...mutationOptions}=options;return this.runTyped("schema",{name,options:{...mutationOptions,fieldType:type,subcommand:"add-field"}})}schemaRemoveField(name,options={}){return this.runTyped("schema",{name,options:{...options,subcommand:"remove-field"}})}schemaListFields(){return this.runTyped("schema",{options:{subcommand:"list-fields"}})}schemaShowField(name){return this.runTyped("schema",{name,options:{subcommand:"show-field"}})}schemaApplyPreset(typePreset,options={}){return this.runTyped("schema",{typePreset,options:{...options,subcommand:"apply-preset"}})}schemaInferTypes(options={}){return this.runTyped("schema",{options:{...options,subcommand:"add-type",infer:!0}})}schemaRenameType(from,to,options){return this.runTyped("schema",{name:from,options:{...options,subcommand:"rename-type",to}})}schemaRenameField(from,to,options,type){return this.runTyped("schema",{name:from,options:{...options,subcommand:"rename-field",to,...type?{fieldTypeScope:type}:{}}})}schemaRemapStatus(from,to,options){return this.runTyped("schema",{name:from,options:{...options,subcommand:"remap-status",to}})}schemaShowStatus(name){return this.runTyped("schema",{name,options:{subcommand:"show-status"}})}profile(subcommand,options={}){return this.runTyped("profile",{options:{...options,subcommand}})}profileList(){return this.runTyped("profile",{options:{subcommand:"list"}})}profileShow(name){return this.runTyped("profile",{name,options:{subcommand:"show"}})}profileApply(name,options={}){return this.runTyped("profile",{name,options:{...options,subcommand:"apply"}})}profileLint(name){return this.runTyped("profile",{name,options:{subcommand:"lint"}})}validate(options={}){return this.runTyped("validate",{options})}health(options={}){return this.runTyped("health",{options})}gc(options={}){return this.runTyped("gc",{options})}assurance(input){return this.runTyped("assurance",{options:{...input,subcommand:input.action}})}historyRedact(id,options){return this.runTyped("history-redact",{id,options})}historyRepair(id,options={}){return this.runTyped("history-repair",{id,options})}historyRepairAll(options={}){return this.runTyped("history-repair",{options:{...options,all:!0}})}historyAttest(options={}){return this.runTyped("history-attest",{options})}historyCompact(id,options={}){return this.runTyped("history-compact",{id,options})}historyCompactBulk(options){return this.runTyped("history-compact",{options})}historyAuthorAcknowledge(options){return this.runTyped("history-author-acknowledge",{historyEvent:(options.events??[]).map(event=>`${event.item_id}:${String(event.line)}`),allActionable:options.all_actionable===!0,dryRun:options.dry_run===!0,planFingerprint:options.plan_fingerprint,limit:options.coordinate_limit,attributedAuthor:options.attributed_author,reviewer:options.reviewer,reason:options.reason})}plan(subcommand,id,options={},stepRef,reorderTo){return this.runTyped("plan",{fullChangedFields:!0,...id===void 0?{}:{id},...stepRef===void 0?{}:{stepRef},...reorderTo===void 0?{}:{reorderTo},options:mutationOptionsWithOverrides(options,{subcommand})})}planCreate(options){return this.plan("create",void 0,options)}planShow(id,options={}){return this.plan("show",id,options)}planAddStep(id,options){return this.plan("add-step",id,options)}planUpdateStep(id,stepRef,options){return this.plan("update-step",id,options,stepRef)}planCompleteStep(id,stepRef,options={}){return this.plan("complete-step",id,options,stepRef)}planBlockStep(id,stepRef,options){return this.plan("block-step",id,options,stepRef)}planReorderStep(id,stepRef,reorderTo,options={}){return this.plan("reorder-step",id,options,stepRef,reorderTo)}planRemoveStep(id,stepRef,options={}){return this.plan("remove-step",id,options,stepRef)}planLink(id,stepRef,options){return this.plan("link",id,options,stepRef)}planUnlink(id,stepRef,options){return this.plan("unlink",id,options,stepRef)}planDecision(id,options){return this.plan("decision",id,options)}planDiscovery(id,options){return this.plan("discovery",id,options)}planValidation(id,options){return this.plan("validation",id,options)}planResume(id,options){return this.plan("resume",id,options)}planApprove(id,options={}){return this.plan("approve",id,options)}planMaterialize(id,options){return this.plan("materialize",id,options)}create(options={}){return this.runTyped("create",splitFullClientMutationOptions(options))}update(id,options={}){return this.runTyped("update",{id,...splitFullClientMutationOptions(options)})}reopen(id,reason,options={}){return this.runTyped("item-reopen",{id,reason,fullChangedFields:!0,options})}close(id,reason,options={}){return this.runTyped("close",{id,reason,...splitFullClientMutationOptions(options)})}claim(id,options={}){return this.runTyped("claim",{id,...splitFullClientMutationOptions(options)})}claimNext(options={}){return this.runTyped("claim",{next:!0,...splitFullClientMutationOptions(options)})}release(id,options={}){return this.runTyped("release",{id,...splitFullClientMutationOptions(options)})}copy(id,options={}){return this.runTyped("copy",{id,...splitFullClientMutationOptions(options)})}delete(id,options={}){return this.runTyped("delete",{id,...splitFullClientMutationOptions(options)})}restore(id,target,options={}){return this.runTyped("restore",{fullChangedFields:!0,id,options:{...options,target}})}focus(id,options={}){return this.runTyped("focus",{...id===void 0?{}:{id},...splitFullClientMutationOptions(options)})}startTask(id,options={}){return this.runTyped("start-task",{id,...splitFullClientMutationOptions(options)})}pauseTask(id,options={}){return this.runTyped("pause-task",{id,...splitFullClientMutationOptions(options)})}closeTask(id,reason,options={}){return this.runTyped("close-task",{id,reason,...splitFullClientMutationOptions(options)})}extension(target,options={}){return this.runTyped("extension",{...target===void 0?{}:{target},options})}extensionList(options={}){return this.extension("list",options)}extensionActivate(target,options={}){return this.runTyped("extension-activate",{target,options})}extensionDeactivate(target,options={}){return this.runTyped("extension-deactivate",{target,options})}package(target,options={}){return this.runTyped("package",{...target===void 0?{}:{target},options:{...options,vocabulary:"package"}})}packageList(options={}){return this.package("list",options)}packageInstall(target,options={}){return this.runTyped("package-install",{target,options})}packageUninstall(target,options={}){return this.runTyped("package-uninstall",{target,options})}packageDoctor(options={}){return this.runTyped("package-doctor",{options})}packageManage(target,options={}){return this.runTyped("package-manage",{...target===void 0?{}:{target},options})}packageDescribe(target,options={}){return this.runTyped("package-describe",{...target===void 0?{}:{target},options})}packageReload(options={}){return this.runTyped("package-reload",{options})}packageCatalog(options={}){return this.runTyped("package-catalog",{options})}packageActivate(target,options={}){return this.runTyped("package-activate",{target,options})}packageDeactivate(target,options={}){return this.runTyped("package-deactivate",{target,options})}packageMigrate(options={}){return this.package(void 0,{...options,migrate:!0})}upgrade(target,options={}){return this.runTyped("upgrade",{...target===void 0?{}:{target},options})}}function context(options={},clientOptions={}){return new PmClient(clientOptions).context(options)}function list(options={},clientOptions={}){return new PmClient(clientOptions).list(options)}function listAllComplete(options={},clientOptions={}){return new PmClient(clientOptions).listAllComplete(options)}function search(query,options={},clientOptions={}){return new PmClient(clientOptions).search(query,options)}function get(id,options={},clientOptions={}){return new PmClient(clientOptions).get(id,options)}function next(options={},clientOptions={}){return new PmClient(clientOptions).next(options)}function aggregate(options={},clientOptions={}){return new PmClient(clientOptions).aggregate(options)}function stats(options={},clientOptions={}){return new PmClient(clientOptions).stats(options)}function duplicates(options={},clientOptions={}){return new PmClient(clientOptions).duplicates(options)}function comments(id,options={},clientOptions={}){return new PmClient(clientOptions).comments(id,options)}function notes(id,options={},clientOptions={}){return new PmClient(clientOptions).notes(id,options)}function learnings(id,options={},clientOptions={}){return new PmClient(clientOptions).learnings(id,options)}function files(id,options={},clientOptions={}){return new PmClient(clientOptions).files(id,options)}function filesDiscover(id,options={},clientOptions={}){return new PmClient(clientOptions).filesDiscover(id,options)}function filesLookup(options,clientOptions={}){return new PmClient(clientOptions).filesLookup(options)}function docs(id,options={},clientOptions={}){return new PmClient(clientOptions).docs(id,options)}function deps(id,options={},clientOptions={}){return new PmClient(clientOptions).deps(id,options)}function graph(subcommand,ids={},options={},clientOptions={}){return new PmClient(clientOptions).graph(subcommand,ids,options)}function append(id,body,options={},clientOptions={}){return new PmClient(clientOptions).append(id,body,options)}function init(prefix,options={},clientOptions={}){return new PmClient(clientOptions).init(prefix,options)}function config(scope,configAction,key,value,options={},clientOptions={}){return new PmClient(clientOptions).config(scope,configAction,key,value,options)}function schema(subcommand,options={},clientOptions={}){return new PmClient(clientOptions).schema(subcommand,options)}function schemaList(clientOptions={}){return new PmClient(clientOptions).schemaList()}function schemaShow(name,clientOptions={}){return new PmClient(clientOptions).schemaShow(name)}function schemaAddType(name,options={},clientOptions={}){return new PmClient(clientOptions).schemaAddType(name,options)}function schemaRemoveType(name,options={},clientOptions={}){return new PmClient(clientOptions).schemaRemoveType(name,options)}function schemaAddStatus(name,options={},clientOptions={}){return new PmClient(clientOptions).schemaAddStatus(name,options)}function schemaRemoveStatus(name,options={},clientOptions={}){return new PmClient(clientOptions).schemaRemoveStatus(name,options)}function schemaAddField(name,options={},clientOptions={}){return new PmClient(clientOptions).schemaAddField(name,options)}function schemaRemoveField(name,options={},clientOptions={}){return new PmClient(clientOptions).schemaRemoveField(name,options)}function schemaListFields(clientOptions={}){return new PmClient(clientOptions).schemaListFields()}function schemaShowField(name,clientOptions={}){return new PmClient(clientOptions).schemaShowField(name)}function schemaApplyPreset(typePreset,options={},clientOptions={}){return new PmClient(clientOptions).schemaApplyPreset(typePreset,options)}function schemaInferTypes(options={},clientOptions={}){return new PmClient(clientOptions).schemaInferTypes(options)}function schemaRenameType(from,to,options,clientOptions={}){return new PmClient(clientOptions).schemaRenameType(from,to,options)}function schemaRenameField(from,to,options,type,clientOptions={}){return new PmClient(clientOptions).schemaRenameField(from,to,options,type)}function schemaRemapStatus(from,to,options,clientOptions={}){return new PmClient(clientOptions).schemaRemapStatus(from,to,options)}function schemaShowStatus(name,clientOptions={}){return new PmClient(clientOptions).schemaShowStatus(name)}function profile(subcommand,options={},clientOptions={}){return new PmClient(clientOptions).profile(subcommand,options)}function profileList(clientOptions={}){return new PmClient(clientOptions).profileList()}function profileShow(name,clientOptions={}){return new PmClient(clientOptions).profileShow(name)}function profileApply(name,options={},clientOptions={}){return new PmClient(clientOptions).profileApply(name,options)}function profileLint(name,clientOptions={}){return new PmClient(clientOptions).profileLint(name)}function validate(options={},clientOptions={}){return new PmClient(clientOptions).validate(options)}function health(options={},clientOptions={}){return new PmClient(clientOptions).health(options)}function gc(options={},clientOptions={}){return new PmClient(clientOptions).gc(options)}function historyRedact(id,options,clientOptions={}){return new PmClient(clientOptions).historyRedact(id,options)}function historyRepair(id,options={},clientOptions={}){return new PmClient(clientOptions).historyRepair(id,options)}function historyRepairAll(options={},clientOptions={}){return new PmClient(clientOptions).historyRepairAll(options)}function historyCompact(id,options={},clientOptions={}){return new PmClient(clientOptions).historyCompact(id,options)}function historyCompactBulk(options,clientOptions={}){return new PmClient(clientOptions).historyCompactBulk(options)}function create(options={},clientOptions={}){return new PmClient(clientOptions).create(options)}function update(id,options={},clientOptions={}){return new PmClient(clientOptions).update(id,options)}function reopen(id,reason,options={},clientOptions={}){return new PmClient(clientOptions).reopen(id,reason,options)}function close(id,reason,options={},clientOptions={}){return new PmClient(clientOptions).close(id,reason,options)}function claim(id,options={},clientOptions={}){return new PmClient(clientOptions).claim(id,options)}function claimNext(options={},clientOptions={}){return new PmClient(clientOptions).claimNext(options)}function release(id,options={},clientOptions={}){return new PmClient(clientOptions).release(id,options)}function copy(id,options={},clientOptions={}){return new PmClient(clientOptions).copy(id,options)}function deleteItem(id,options={},clientOptions={}){return new PmClient(clientOptions).delete(id,options)}function restore(id,target,options={},clientOptions={}){return new PmClient(clientOptions).restore(id,target,options)}function focus(id,options={},clientOptions={}){return new PmClient(clientOptions).focus(id,options)}function startTask(id,options={},clientOptions={}){return new PmClient(clientOptions).startTask(id,options)}function pauseTask(id,options={},clientOptions={}){return new PmClient(clientOptions).pauseTask(id,options)}function closeTask(id,reason,options={},clientOptions={}){return new PmClient(clientOptions).closeTask(id,reason,options)}function extension(target,options={},clientOptions={}){return new PmClient(clientOptions).extension(target,options)}function extensionList(options={},clientOptions={}){return new PmClient(clientOptions).extensionList(options)}function extensionActivate(target,options={},clientOptions={}){return new PmClient(clientOptions).extensionActivate(target,options)}function extensionDeactivate(target,options={},clientOptions={}){return new PmClient(clientOptions).extensionDeactivate(target,options)}function packageLifecycle(target,options={},clientOptions={}){return new PmClient(clientOptions).package(target,options)}function packageList(options={},clientOptions={}){return new PmClient(clientOptions).packageList(options)}function packageInstall(target,options={},clientOptions={}){return new PmClient(clientOptions).packageInstall(target,options)}function packageUninstall(target,options={},clientOptions={}){return new PmClient(clientOptions).packageUninstall(target,options)}function packageDoctor(options={},clientOptions={}){return new PmClient(clientOptions).packageDoctor(options)}function packageManage(target,options={},clientOptions={}){return new PmClient(clientOptions).packageManage(target,options)}function packageDescribe(target,options={},clientOptions={}){return new PmClient(clientOptions).packageDescribe(target,options)}function packageReload(options={},clientOptions={}){return new PmClient(clientOptions).packageReload(options)}function packageCatalog(options={},clientOptions={}){return new PmClient(clientOptions).packageCatalog(options)}function packageActivate(target,options={},clientOptions={}){return new PmClient(clientOptions).packageActivate(target,options)}function packageDeactivate(target,options={},clientOptions={}){return new PmClient(clientOptions).packageDeactivate(target,options)}function upgrade(target,options={},clientOptions={}){return new PmClient(clientOptions).upgrade(target,options)}async function getContracts(pmRootOrOptions,options={}){const resolvedOptions=typeof pmRootOrOptions=="string"?{...options,pmRoot:pmRootOrOptions}:pmRootOrOptions??options,global2={json:!0,quiet:resolvedOptions.quiet??!0,noExtensions:resolvedOptions.noExtensions??!1,noPager:!0,profile:resolvedOptions.profile??!1,path:resolvedOptions.pmRoot};return runContracts(resolvedOptions,global2)}const extensionActivationGate=createAsyncReadWriteGate(),activeExtensionScope=new AsyncLocalStorage;function resetActiveExtensionRegistries(){setActiveExtensionHooks(createEmptyExtensionHookRegistry()),setActiveExtensionCommands(createEmptyExtensionCommandRegistry()),setActiveExtensionParsers(createEmptyExtensionParserRegistry()),setActiveExtensionPreflight(createEmptyExtensionPreflightRegistry()),setActiveExtensionServices(createEmptyExtensionServiceRegistry()),setActiveExtensionRenderers(createEmptyExtensionRendererRegistry()),setActiveExtensionRegistrations(createEmptyExtensionRegistrationRegistry())}async function withActiveExtensions(global2,explicitCwd,resolutionCwd,run){return runWithIsolatedExtensionRuntime(()=>explicitCwd===void 0?extensionActivationGate.read(()=>withActiveExtensionsExclusively(global2,resolutionCwd,run)):extensionActivationGate.write(()=>withCwd(explicitCwd,()=>withActiveExtensionsExclusively(global2,resolutionCwd,run))))}async function runWithActiveExtensions(options,run){const explicitCwd=options.cwd;if(activeExtensionScope.getStore()===!0&&explicitCwd===void 0&&options.noExtensions===!0){const pmRoot=resolvePmRoot(process.cwd(),options.path);return runWithIsolatedExtensionRuntime(()=>runWithDiscoveredContextIntentContracts({pmRoot},run))}const resolutionCwd=explicitCwd??process.cwd();return withActiveExtensions(globalOptions({path:options.path,noExtensions:options.noExtensions}),explicitCwd,resolutionCwd,()=>activeExtensionScope.run(!0,run))}function describeActivationFailure(error){try{const stack=error instanceof Error?error.stack:void 0,description=typeof stack=="string"?stack:describeUnknownError(error);return typeof description=="string"?description:"Unknown failure"}catch{return"Unknown failure"}}async function withActiveExtensionsExclusively(global2,cwd,run){const pmRoot=resolvePmRoot(cwd,global2.path);if(global2.noExtensions)return resetActiveExtensionRegistries(),runWithDiscoveredContextIntentContracts({pmRoot},()=>run(null));if(!await pathExists(getSettingsPath(pmRoot)))return resetActiveExtensionRegistries(),run(null);let active=null,activated;try{const settings=await readSettings(pmRoot),loadResult=await loadExtensions({pmRoot,settings,cwd,noExtensions:!1}),activationResult=await activateExtensions({...loadResult,loaded:loadResult.loaded});activated={loadResult,activationResult},setActiveExtensionHooks(activationResult.hooks),setActiveExtensionCommands(activationResult.commands),setActiveExtensionParsers(activationResult.parsers),setActiveExtensionPreflight(activationResult.preflight),setActiveExtensionServices(activationResult.services),setActiveExtensionRenderers(activationResult.renderers),setActiveExtensionRegistrations(activationResult.registrations),active={registrations:activationResult.registrations,commands:activationResult.commands,pmRoot,packages:loadResult.loaded}}catch(error){resetActiveExtensionRegistries(),console.error("[pm-sdk] extension activation failed; continuing without active extensions:",describeActivationFailure(error))}try{return await runWithDiscoveredContextIntentContracts({pmRoot,packages:active?.packages},()=>run(active))}finally{resetActiveExtensionRegistries(),activated&&await deactivateExtensions(activated.loadResult,activated.activationResult).catch(()=>{})}}function resolveActiveExtensionActionCommand(action,active){const normalizedAction=normalizeActionName(action);return active?.registrations.commands.find(entry=>normalizeActionName(entry.action)===normalizedAction)?.command??active?.commands.handlers.find(entry=>normalizeActionName(entry.command)===normalizedAction)?.command}async function dispatchActiveExtensionAction(action,args,options,global2,active){if(!active)throw new PmCliError(`Unsupported native pm action: ${action}`,EXIT_CODE.USAGE);const command=resolveActiveExtensionActionCommand(action,active);if(!command)throw new PmCliError(`Unsupported native pm action: ${action}`,EXIT_CODE.USAGE);const extensionAuthor=typeof options.author=="string"?options.author:global2.author,handlerResult=await runActiveCommandHandler({command:normalizeCommandPath(command),args:readStringArray(options.args??args.args),options:extensionOptionsFromArgs(args,options),global:{...global2,author:extensionAuthor},pm_root:active.pmRoot,sdk:createExtensionCommandSdk(active.pmRoot,PmClient.forActiveExtensionHost({pmRoot:active.pmRoot,author:extensionAuthor}),extensionAuthor,normalizeCommandPath(command))});if(!handlerResult.handled){if(Object.hasOwn(handlerResult,"cause"))throw createExtensionCommandError(command,handlerResult);const suffix=handlerResult.warnings.length>0?` (${handlerResult.warnings.join(", ")})`:"";throw new PmCliError(`Unsupported native pm action: ${action}${suffix}`,EXIT_CODE.USAGE)}return handlerResult.result}async function withCwd(cwd,run){const previous=process.cwd();process.chdir(cwd);try{return await run()}finally{process.chdir(previous)}}function resolveSdkActionInput(args){const rawAction=readRequiredString(args,"action"),normalizedAction=normalizeActionName(rawAction),alias=getOwnHandler(SDK_ACTION_ALIASES,normalizedAction),action=alias?.action??normalizedAction,resolvedArgs={...args,action};return alias?.options!==void 0&&(resolvedArgs.options={...alias.options,...asRecordClone(args.options)}),action==="package"&&(resolvedArgs.options={...asRecordClone(resolvedArgs.options),vocabulary:"package"}),{action,args:resolvedArgs}}function revisionRecoveryScopeArgs(args,global2,explicitCwd,resolutionCwd){const hostContext=args[ACTIVE_EXTENSION_HOST_CONTEXT]===!0,isolation=global2.noExtensions===!0&&!hostContext?["--no-extensions"]:[];if(explicitCwd!==void 0)return["--pm-path",resolvePmRoot(resolutionCwd,global2.path),...isolation];const scoped=resolvePmCommandScopeArgs(global2,resolutionCwd);return[...global2.noExtensions===!0?scoped.slice(0,-1):scoped,...isolation]}async function runAction(args){const resolved=resolveSdkActionInput(args),global2=globalOptions(resolved.args);capturePmCommandScope(global2);const invalidateWorkspaceContractsCache=shouldInvalidateWorkspaceContractsCacheAfterAction(resolved.action),explicitCwd=readString(resolved.args,"cwd"),resolutionCwd=explicitCwd??process.cwd();resolved.action==="init"&&(global2[INIT_INVOCATION_CWD]=resolutionCwd),(resolved.action!=="init"||global2.path!==void 0||(process.env.PM_PATH?.trim().length??0)>0)&&(global2.path=resolvePmRoot(resolutionCwd,global2.path));const{expectHash,dispatchArgs}=splitExpectHashInput(resolved.args),dispatch=async activeExtensions=>{if(expectHash===void 0)return dispatchAction(resolved.action,dispatchArgs,global2,activeExtensions);const{dispatchWithExpectedItemRevisions}=await import("./lifecycle/item-revision.js");return dispatchWithExpectedItemRevisions({action:resolved.action,expectHash,defaultId:readString(dispatchArgs,"id")??readString(asRecordClone(dispatchArgs.options),"id"),options:asRecordClone(dispatchArgs.options),background:dispatchArgs.background,pmRoot:resolvePmRoot(resolutionCwd,global2.path),invocation:{scopeArgs:revisionRecoveryScopeArgs(args,global2,explicitCwd,resolutionCwd),...global2.outputFormat===void 0?{}:{outputArgs:["--output-format",global2.outputFormat]}},run:()=>dispatchAction(resolved.action,dispatchArgs,global2,activeExtensions)})};try{return resolved.action==="history-attest"?await dispatch(null):args[ACTIVE_EXTENSION_HOST_CONTEXT]===!0||activeExtensionScope.getStore()===!0?await dispatch(null):await withActiveExtensions(global2,explicitCwd,resolutionCwd,activeExtensions=>dispatch(activeExtensions))}finally{invalidateWorkspaceContractsCache&&clearWorkspaceContractsCache()}}function analyzeSdkActionCoverage(actions=PM_TOOL_ACTIONS){return actions.map(action=>{const normalized=normalizeActionName(action),alias=getOwnHandler(SDK_ACTION_ALIASES,normalized),resolvedAction=alias?.action??normalized,covered=getOwnHandler(SDK_ACTION_HANDLERS,resolvedAction)!==void 0;return{action,resolved_action:resolvedAction,covered,route:covered?alias?"alias":"native":"missing"}})}async function dispatchAction(action,args,global2,activeExtensions){const options=optionsWithAuthor(args,action);if(action==="create"||action==="update"){const{assertNativeMutationOptions}=await import("./runtime/mutation-admission.js");await assertNativeMutationOptions(action,args,options,global2.path,HOISTED_ACTION_OPTION_KEYS[action])}const handler=getOwnHandler(SDK_ACTION_HANDLERS,action),extensionCommand=handler?void 0:resolveActiveExtensionActionCommand(action,activeExtensions),readCommand=extensionCommand===void 0?action:`extension:${extensionCommand}`;validateReadOutputOptions(readCommand,options),normalizeReadOutputIncludeModeOptions(readCommand,options);const ctx={action,args,options,id:readString(args,"id"),force:args.force===!0||options.force===!0,global:global2,activeExtensions},result=handler?await handler(ctx):await dispatchActiveExtensionAction(action,args,options,global2,activeExtensions);if(action==="history-attest")return result;{const projected=attachReadOutputContracts(readCommand,options,result);return await finalizeContextUsageEgress(resolvePmRoot(process.cwd(),global2.path),projected),projected}}const actionRunnerTestHooks={closeManyOptionsFromFlat,extensionOptionsFromArgs,globalOptions,mutationListOptions,normalizeActionName,normalizeCommandPath,normalizeMcpUpdateOptions,normalizeMcpOptionsArrays,optionsWithAuthor,readRequiredString,readScalarString,readScalarStringAllowBlank,readStringArray,updateManyOptionsFromFlat,withAddNoteOption,withFilesDiscoveryOptions,withMutationCompaction};(process.env.NODE_ENV==="test"||process.env.VITEST!==void 0||process.env.VITEST_WORKER_ID!==void 0)&&(globalThis.__pmCliActionRunnerTestHooks=actionRunnerTestHooks);import{readRequiredString as readRequiredString2}from"./runtime/context.js";export{BASELINE_ITEM_FORMAT_VERSION,BUILTIN_ITEM_TYPE_VALUES,CONFIDENCE_TEXT_VALUES,CONTEXT_OUTPUT_VALUES,CURRENT_ITEM_FORMAT_VERSION,DEFAULT_TERMINAL_TRANSITION_POLICY,DEPENDENCY_KIND_VALUES,EXIT_CODE,HISTORY_EVENT_CLASSIFICATION_VERSION,ISSUE_SEVERITY_VALUES,ITEM_TYPE_VALUES,MAINTENANCE_HISTORY_OPERATIONS,NEXT_OUTPUT_VALUES,PM_CLI_ERROR_DETAILS_LIMITS,PM_CLI_EXPECTED_ERROR_NAME,PM_GITIGNORE_END,PM_GITIGNORE_START,PmCliError2 as PmCliError,PmClient,PmCompleteListValidationError,RISK_VALUES,SEARCH_EXTENSION_FLAG_DEFINITIONS,STATUS_VALUES,SUBSTANTIVE_HISTORY_OPERATIONS,acquireLock,acquireLockLease,aggregate,analyzeSdkActionCoverage,append,appendHistoryEntry,applyTerminalOrderingPolicy,assertCompleteListResult,canonicalDocument,certifyCompleteListResult2 as certifyCompleteListResult,claim,claimNext,classifyHistoryEvent,classifyItemFormatVersion,clearWorkspaceContractsCache2 as clearWorkspaceContractsCache,close,closeItem,closeTask,comments,commitImportedItem,config,context,copy,create,createCompleteListOptions2 as createCompleteListOptions,createHistoryEntry,createPmCliExpectedError,deleteItem,deps,docs,duplicates,effectiveItemFormatVersion,emptyImportedDocument,ensurePmGitignore,ensureTrackerInitialized,extension,extensionActivate,extensionDeactivate,extensionList,files,filesDiscover,filesLookup,focus,gc,generateItemId,get,getActiveExtensionRegistrations,getContracts,getHistoryPath,getItemPath,getPmGitignoreBlock,getSettingsPath2 as getSettingsPath,getWorkspaceContracts,graph,health,historyCompact,historyCompactBulk,historyRedact,historyRepair,historyRepairAll,init,inspectCompleteListResult,isPmCliErrorDetails,isPmCliExpectedError,isTerminalStatus,isTimestampLiteral,jaccardSimilarity,learnings,list,listAllComplete,listAllItemMetadata,listAllItemMetadataLight,loadCreateTemplateOptions,locateItem,next,normalizeItemFormatVersion,normalizeItemId,normalizeItemMetadata,normalizeRawItemId,normalizeSimilarityText,normalizeStatusInput,notes,nowIso,packageActivate,packageCatalog,packageDeactivate,packageDescribe,packageDoctor,packageInstall,packageLifecycle,packageList,packageManage,packageReload,packageUninstall,parseTags,pathExists2 as pathExists,pauseTask,profile,profileApply,profileLint,profileList,profileShow,projectPmCliErrorContextDetails,projectPmCliErrorDetails,readBooleanOption,readCsvListOption,readFileIfExists,readLocatedItem,readRequiredString2 as readRequiredString,readSettings2 as readSettings,readStringOption,release,removeFileIfExists,renderCalendarMarkdown,renderCalendarToon,renderGuideMarkdown,reopen,requireTerminalReason,resolveCalendarOutputFormat,resolveGuideOutputFormat,resolveImplicitPmRoot,resolveItemTypeRegistry,resolvePmRoot2 as resolvePmRoot,resolveRuntimeFieldRegistry,resolveRuntimeStatusRegistry,resolveTerminalReason,restore,runAction,runActiveOnReadHooks,runActiveOnWriteHooks,runAggregate,runCalendar,runClose,runCloseTask,runCompletion,runContext,runCopy,runDelete,runDuplicates,runFocus,runGet,runGuide,runList,runNext,runPauseTask,runReindex,runReopen,runRestore,runSearch,runStartTask,runStats,runTemplatesList,runTemplatesSave,runTemplatesShow,runTestRunsList,runTestRunsLogs,runTestRunsResume,runTestRunsStatus,runTestRunsStop,runUpdate,runWithActiveExtensions,scanItemFormatVersions,schema,schemaAddField,schemaAddStatus,schemaAddType,schemaApplyPreset,schemaInferTypes,schemaList,schemaListFields,schemaRemapStatus,schemaRemoveField,schemaRemoveStatus,schemaRemoveType,schemaRenameField,schemaRenameType,schemaShow,schemaShowField,schemaShowStatus,scoreItemSimilarity,search,selectImportAuthor,serializeItemDocument,snapshotPmCliErrorContext,splitFrontMatter,startTask,stats,toEstimatedMinutesValue,toImportBoolean,toImportConfidence,toImportInteger,toImportLinkedDocs,toImportLinkedFiles,toImportLinkedTests,toImportLogEntries,toImportNormalizedEnum,toImportNumberMap,toImportPriority,toImportStatus,toImportStringList,toImportStringMap,toImportTags,toNonEmptyImportString,tokenizeSimilarityText,update,upgrade,validate,withCliMutationInput,withLiteralMutationInput,writeFileAtomic};
2
2
  //# sourceMappingURL=runtime.js.map
@@ -1,7 +1,8 @@
1
1
  # Recovering missing close evidence
2
2
 
3
- Tracked by [pm-ub1ott](../.agents/pm/issues/pm-ub1ott.toon) and
4
- [pm-gh1464](../.agents/pm/issues/pm-gh1464.toon).
3
+ Tracked by [pm-ub1ott](../.agents/pm/issues/pm-ub1ott.toon),
4
+ [pm-gh1464](../.agents/pm/issues/pm-gh1464.toon) and
5
+ [pm-gh1676](../.agents/pm/issues/pm-gh1676.toon).
5
6
 
6
7
  `pm close --validate-close warn` can close an item while reporting missing
7
8
  resolution, expected outcome, or actual outcome. Its SDK result and compact CLI
@@ -42,3 +43,36 @@ pm close <item-id> "Delivered and verified" --resolution "What changed" \
42
43
  ```
43
44
 
44
45
  Warning-mode follow-up exists for incomplete historical or interrupted workflows.
46
+
47
+ ## Strict closes refused for missing evidence
48
+
49
+ `pm close --validate-close strict` refuses with
50
+ `close_validation_missing_fields` (exit 2) and writes nothing. Because
51
+ `pm close` accepts `--resolution`, `--expected-result` and `--actual-result`
52
+ itself, `recovery.suggested_retry_args` is the caller's own close invocation
53
+ with each missing flag appended. Every typed token is kept as it was: the item
54
+ id, reason, tracker selection, `--json`, `--expect-hash` and the rest. The
55
+ appended flag also overrides a blank value supplied for that field, because the
56
+ parser keeps the last value of a repeated option. When a `--` follows the
57
+ command, the flags go directly after the command token instead. When the
58
+ invocation named no tracker, the tracker an environment selection (`PM_PATH`)
59
+ resolved is prepended. Replace each `<value>` and run it: one write records the
60
+ evidence and the closure in the same history entry.
61
+
62
+ When the refused command cannot accept the missing fields itself (for example
63
+ `pm close-task`), or the flags cannot be placed safely, the refusal proposes no
64
+ retry rather than one that drops the caller's tokens. `recovery.missing` still
65
+ names the fields: record them with `recovery.next_best_command`, then repeat the
66
+ original command. An SDK close whose `lifecyclePolicy` override has no CLI
67
+ spelling likewise gets no CLI retry and is told to retry the SDK call with the
68
+ evidence supplied. An SDK or MCP retry carries the revision guards
69
+ (`--expect-hash=<id>=<hash>`) that the refused operation ran under.
70
+
71
+ ```bash
72
+ pm --pm-path <tracker-root> close <item-id> "Delivered" --validate-close strict \
73
+ --resolution "<value>" --expected-result "<value>" --actual-result "<value>"
74
+ ```
75
+
76
+ `recovery.next_best_command` keeps the two-step route (`pm update` with the
77
+ missing fields, then the close) for callers that must record evidence before
78
+ deciding to close. It costs a second write and history entry.
package/docs/COMMANDS.md CHANGED
@@ -1024,7 +1024,16 @@ the subcommand; `plan create` has none). `<id>=<item_hash>`
1024
1024
  (repeatable or comma-separated) names targets explicitly and is required for
1025
1025
  commands without one item argument. The refusal reports `expected_revision`,
1026
1026
  `current_revision`, and `details.changes_since` (the newest 10 history entries
1027
- since the declared revision, with their top-level `fields`). The refused write
1027
+ since the declared revision, with their top-level `fields`). Its `required`,
1028
+ `examples` and `nextSteps` are read-only re-reads (`get` and `history`) rendered
1029
+ for the refused invocation
1030
+ ([pm-gh1677](../.agents/pm/issues/pm-gh1677.toon)): they keep its tracker
1031
+ selection (`--pm-path`/`--path`, or `PM_PATH` when that tracker is not the cwd
1032
+ default), `--no-extensions` and output encoding, so replaying them reads the
1033
+ refused item and its history from the same tracker. Those reads are live, not
1034
+ pinned to `current_revision`: a write after the refusal shows up in them, so
1035
+ decide against the `item_hash` they report. The guard never retries the write
1036
+ or replaces the expected hash itself. The refused write
1028
1037
  is suppressed; writes the same command already committed (for example the
1029
1038
  claim of a composed `claim --start`) stay durable, and the message then says
1030
1039
  so ("Earlier writes by this same invocation already committed"). Read commands refuse the flag with
@@ -69,13 +69,34 @@ because a present-day target status cannot certify a past prerequisite state.
69
69
  Omission receipts account for what the result actually renders. A reminder or
70
70
  event supplied through `schedule.reminders` or `schedule.events` is included even
71
71
  when its metadata alias is absent. Nonempty files, tests and docs rendered under
72
- `linked` are included too. Narrow selectors continue to disclose unselected
73
- material members; the stable linked envelope's empty placeholders do not certify
74
- that unrequested artifact contents were returned.
72
+ `linked` are included too.
73
+
74
+ Nested selectors return only what they name
75
+ ([pm-gh1663](../.agents/pm/issues/pm-gh1663.toon)). `--fields linked.files`
76
+ returns `linked.files` alone. It never pads `linked.tests` or `linked.docs`
77
+ with empty arrays, so in JSON, SDK and MCP results a present empty array always
78
+ means the group is empty. `--fields claim_state.claimed` returns only that
79
+ member, the same way `schedule.<member>` selectors already work. The whole
80
+ `linked` or `claim_state` selector returns every member, and so do standard and
81
+ deep depth reads; `--depth brief` omits both facets.
82
+ When a nested selector leaves out a populated sibling, the omission receipt
83
+ names it as `<facet>.<member>` with a narrow restoration, for example
84
+ `linked.tests` restored with `--fields linked.tests`. A sibling that is empty,
85
+ null or `false` carries no withheld evidence and is not listed. Neither is a
86
+ sibling returned through its item metadata field: `--fields linked.files,tests`
87
+ already returns the tests as `item.tests`, and the same holds for `deadline`,
88
+ `reminders`, `events` and `assignee`. TOON keeps its
89
+ sparse policy and drops empty groups. There, a group is known to be empty only
90
+ when its facet was selected through a nested selector and the receipt does not
91
+ list it. A facet the projection never selected stays unknown: `--fields
92
+ item.title` returns no `linked` group and lists none, whether or not the item
93
+ has linked files. Rendering requested empty groups in TOON is tracked by
94
+ [pm-sj66lm](../.agents/pm/issues/pm-sj66lm.toon).
75
95
 
76
96
  ```bash
77
97
  pm get <id> --fields schedule.reminders
78
98
  pm get <id> --fields linked.tests
99
+ pm get <id> --fields claim_state.claimed
79
100
  ```
80
101
 
81
102
  The regression suite creates actual disposable tracker data and checks open,
@@ -9,6 +9,13 @@ check details. Warning and failure details remain available by default.
9
9
  `--full` restores structured evidence; `--brief` never expands an individual
10
10
  check's serialized detail beyond the standard projection. Summary and check-only
11
11
  verdict semantics remain unchanged. SDK `runHealth` and MCP use the same engine.
12
+ For `pm health`, `--full` widens the check scope. An explicit `--summary` or
13
+ `--brief` still selects the projection, so `pm health --full --summary` runs
14
+ every check and returns the summary instead of silently dropping the flag.
15
+ `--strict-exit` only implies the summary and leaves `--full` details in place
16
+ ([pm-gh1670](../.agents/pm/issues/pm-gh1670.toon)). This differs from `list`,
17
+ `graph` and `deps`, where `--full` is purely a projection and refuses
18
+ `--summary` or `--brief` as a conflict.
12
19
 
13
20
  Tracker references: [pm-p258tx](../.agents/pm/features/pm-p258tx.toon),
14
21
  [pm-cyrfjq](../.agents/pm/issues/pm-cyrfjq.toon), and
package/docs/RELEASING.md CHANGED
@@ -465,12 +465,30 @@ pnpm release:pipeline
465
465
 
466
466
  The static phase includes `pnpm sdk:surface:check`,
467
467
  `pnpm benchmark:sdk-entrypoints:check`, and
468
- `pnpm benchmark:transport:check`. The packaging phase runs
469
- `pnpm quality:package-artifact`, which evaluates npm's actual packlist against
470
- the committed unpacked-size, file-count, required-runtime-file, and forbidden
471
- source-map budgets. Release additionally reruns the packlist gate immediately
472
- after Sentry debug-ID injection and before any Sentry upload or finalization,
473
- using the separately committed `sentry-injected` ceiling. CI constrains the base
468
+ `pnpm benchmark:transport:check`. The packaging phase runs the
469
+ `package-artifact` preflight step (`scripts/release/package-artifact-gate.mjs`,
470
+ the gate behind `pnpm quality:package-artifact`) before any version commit or
471
+ tag exists. It evaluates npm's actual packlist against the committed
472
+ unpacked-size, file-count, required-runtime-file, and forbidden source-map
473
+ budgets, so an over-budget candidate never receives an immutable tag. The
474
+ `package-artifact-sentry-injected` step then runs the same gate with
475
+ `--profile=sentry-injected --simulate-injection`. It runs the installed
476
+ `sentry-cli` on a disposable copy of `dist/` and adds each packed file's
477
+ measured growth to the packlist, so it checks the bytes the release will
478
+ publish without rewriting the checkout. An incremental rebuild does not
479
+ re-emit unchanged modules, so injecting the checkout itself would leave
480
+ injected files behind. Release
481
+ additionally reruns the packlist gate immediately after Sentry debug-ID
482
+ injection and before any Sentry upload or finalization, using the derived
483
+ `sentry-injected` profile: the base ceiling plus `max_bytes_per_injected_file`
484
+ for every packed `dist/**/*.js` file. `sentry-cli sourcemaps inject dist/`
485
+ adds one fixed-length snippet to each such file (358 bytes with
486
+ `@sentry/cli` 3.8.2), so a fixed allowance stopped covering the transform once
487
+ the file count grew and blocked the already-tagged 2026.11.5
488
+ ([pm-998juj](../.agents/pm/tasks/pm-998juj.toon)).
489
+ `tests/unit/scripts/release/sentry-injection-allowance.spec.ts` runs the
490
+ installed `sentry-cli` against a fixture, so an upgrade that grows the snippet
491
+ fails in the pull request that upgrades it, not on a tag. CI constrains the base
474
492
  build, publication constrains the exact mutated artifact users install, and a
475
493
  rejected package cannot leave finalized observability artifacts. Additive SDK
476
494
  exports require a reviewed
@@ -496,6 +514,23 @@ so `PM_ERROR_CODE_CATALOG` and every serialized projection stay byte-identical.
496
514
  The catalog appears once in the tsc emit and once in each CLI bundle, and the
497
515
  compact rows removed about 320 KB from the packed distribution.
498
516
 
517
+ The publication tree ships only the emitted declarations a consumer can reach
518
+ ([pm-998juj](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/tasks/pm-998juj.toon)).
519
+ `exportedDeclarationClosure` in `scripts/release/package-distribution.mjs`
520
+ walks every exported `types` entry through its relative `from` and `import()`
521
+ specifiers. The exports map refuses unexported subpaths, so a consumer cannot
522
+ import any other `dist/**/*.d.ts`: the CLI internals behind `./cli`, the MCP
523
+ servers, and internal SDK and core modules. Packing leaves those out, and the
524
+ checkout keeps every declaration. A manifest without an exports map ships every
525
+ declaration, because any subpath then stays importable. The walk fails closed. An exported or
526
+ referenced declaration missing from the packlist, or a relative specifier that
527
+ is not a `.js` module path, refuses the pack instead of publishing a dangling
528
+ type reference. The packed smoke's strict TypeScript consumer imports every
529
+ exported types entry, so it compiles the complete shipped closure. The cut
530
+ dropped 212 declarations (266,135 bytes) from the 2026.11.6 distribution.
531
+ Artifact ceilings remain unchanged. The tsc `.js` emit still ships, because the
532
+ `pm` and MCP bins and the `./cli` export import it directly.
533
+
499
534
  5. Land the implementation through a reviewed pull request, then use hosted
500
535
  preparation for publication.
501
536