@unbrained/pm-cli 2026.8.4 → 2026.8.6

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 (253) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +53 -13
  3. package/dist/cli/error-guidance.js +4 -4
  4. package/dist/cli/main.js +12 -37
  5. package/dist/cli/register-setup.d.ts +1 -1
  6. package/dist/cli/register-setup.js +46 -20
  7. package/dist/cli/register-structured-mutation.d.ts +2 -0
  8. package/dist/cli/register-structured-mutation.js +124 -12
  9. package/dist/cli-bundle/bundle-manifest.json +397 -397
  10. package/dist/cli-bundle/chunks/append-XAJ5Z4XS.js +2 -0
  11. package/dist/cli-bundle/chunks/{chunk-QVO3VTA4.js → chunk-343QETLI.js} +2 -2
  12. package/dist/cli-bundle/chunks/{chunk-Q5F6OI7C.js → chunk-3KFVGGRE.js} +2 -2
  13. package/dist/cli-bundle/chunks/{chunk-6S7I3UKV.js → chunk-3ZJRFYY2.js} +19 -19
  14. package/dist/cli-bundle/chunks/{chunk-NFF3JAQR.js → chunk-4AVFKHHC.js} +2 -2
  15. package/dist/cli-bundle/chunks/{chunk-5H47J5FG.js → chunk-4OVGQW22.js} +2 -2
  16. package/dist/cli-bundle/chunks/{chunk-D2MBVMVE.js → chunk-5PBP2ZP3.js} +2 -2
  17. package/dist/cli-bundle/chunks/chunk-5ZKQPA44.js +2 -0
  18. package/dist/cli-bundle/chunks/chunk-A3XQ7VPU.js +2 -0
  19. package/dist/cli-bundle/chunks/chunk-AJE3AHPD.js +8 -0
  20. package/dist/cli-bundle/chunks/{chunk-2POYGY53.js → chunk-AOBDLU4T.js} +2 -2
  21. package/dist/cli-bundle/chunks/{chunk-PYYPQLHC.js → chunk-AYRUGRNS.js} +2 -2
  22. package/dist/cli-bundle/chunks/{chunk-QMWUL66F.js → chunk-BP6EMEDP.js} +5 -5
  23. package/dist/cli-bundle/chunks/{chunk-UVZREFZU.js → chunk-C3YABSJK.js} +2 -2
  24. package/dist/cli-bundle/chunks/{chunk-RB65T4RX.js → chunk-CA3BURYF.js} +2 -2
  25. package/dist/cli-bundle/chunks/{chunk-KIKLF2W4.js → chunk-D7I3TUGV.js} +2 -2
  26. package/dist/cli-bundle/chunks/{chunk-PQXEB7W4.js → chunk-DQGJ2RWT.js} +2 -2
  27. package/dist/cli-bundle/chunks/{chunk-OB7TRZ2G.js → chunk-DWOAOZHZ.js} +2 -2
  28. package/dist/cli-bundle/chunks/{chunk-SVDH5CHC.js → chunk-E7BFPLUZ.js} +4 -4
  29. package/dist/cli-bundle/chunks/{chunk-CGY5I2GO.js → chunk-F4NREH3G.js} +2 -2
  30. package/dist/cli-bundle/chunks/{chunk-DCJ6CM6F.js → chunk-FDBRXV25.js} +2 -2
  31. package/dist/cli-bundle/chunks/{chunk-NM5G7RLU.js → chunk-GU3TSEHD.js} +2 -2
  32. package/dist/cli-bundle/chunks/chunk-HS7OVAUN.js +164 -0
  33. package/dist/cli-bundle/chunks/{chunk-CU5ENFNP.js → chunk-JFZIS6JF.js} +2 -2
  34. package/dist/cli-bundle/chunks/{chunk-GOICHIX4.js → chunk-JQ4NZ5EB.js} +2 -2
  35. package/dist/cli-bundle/chunks/{chunk-HE3DZFN4.js → chunk-L6LGKJX3.js} +2 -2
  36. package/dist/cli-bundle/chunks/{chunk-BLINBTMX.js → chunk-M357ZCOR.js} +2 -2
  37. package/dist/cli-bundle/chunks/{chunk-NRDKVOUE.js → chunk-M4VEE3FK.js} +2 -2
  38. package/dist/cli-bundle/chunks/{chunk-HTYC76A4.js → chunk-MCS73BKB.js} +2 -2
  39. package/dist/cli-bundle/chunks/{chunk-BKMZTZYL.js → chunk-MDTH7SAE.js} +2 -2
  40. package/dist/cli-bundle/chunks/{chunk-H6FITE7D.js → chunk-NE5VRDAI.js} +2 -2
  41. package/dist/cli-bundle/chunks/{chunk-NPUJ7OLK.js → chunk-OXY3SJ3N.js} +2 -2
  42. package/dist/cli-bundle/chunks/chunk-PECV7L5T.js +2 -0
  43. package/dist/cli-bundle/chunks/{chunk-KH4GVBMC.js → chunk-Q3VOP62W.js} +2 -2
  44. package/dist/cli-bundle/chunks/{chunk-FQ4EFFDU.js → chunk-QJ7C3JIW.js} +2 -2
  45. package/dist/cli-bundle/chunks/{chunk-VH2EAGUG.js → chunk-R6LSRGPS.js} +2 -2
  46. package/dist/cli-bundle/chunks/{chunk-HQ2WU7OY.js → chunk-R6RKEYYW.js} +2 -2
  47. package/dist/cli-bundle/chunks/{chunk-PA5XRN2A.js → chunk-RAFUN7IX.js} +4 -4
  48. package/dist/cli-bundle/chunks/chunk-RUAU5OSH.js +2 -0
  49. package/dist/cli-bundle/chunks/chunk-SD3YXU2U.js +56 -0
  50. package/dist/cli-bundle/chunks/{chunk-JMKVCQSE.js → chunk-SV3YQ4RY.js} +2 -2
  51. package/dist/cli-bundle/chunks/{chunk-B5ZLCD5Z.js → chunk-SVV3DQES.js} +2 -2
  52. package/dist/cli-bundle/chunks/{chunk-J4EPW4GT.js → chunk-SXECIECW.js} +2 -2
  53. package/dist/cli-bundle/chunks/chunk-T45OHXDW.js +8 -0
  54. package/dist/cli-bundle/chunks/{chunk-NH35JNK5.js → chunk-TPKDJ5WL.js} +2 -2
  55. package/dist/cli-bundle/chunks/{chunk-ZSH4GNBH.js → chunk-UVVXHGYS.js} +2 -2
  56. package/dist/cli-bundle/chunks/chunk-V663653R.js +20 -0
  57. package/dist/cli-bundle/chunks/{chunk-5PZGZMPG.js → chunk-WSI5KZQJ.js} +2 -2
  58. package/dist/cli-bundle/chunks/{chunk-3XZYTRPC.js → chunk-XPOQQJTX.js} +2 -2
  59. package/dist/cli-bundle/chunks/{chunk-UJHUR3LZ.js → chunk-YCCDXBNU.js} +2 -2
  60. package/dist/cli-bundle/chunks/chunk-ZFBWCKYF.js +2 -0
  61. package/dist/cli-bundle/chunks/close-DI66JMSB.js +2 -0
  62. package/dist/cli-bundle/chunks/close-many-VFKT6U3O.js +2 -0
  63. package/dist/cli-bundle/chunks/comments-E73HIEZJ.js +2 -0
  64. package/dist/cli-bundle/chunks/copy-WBYVLCPC.js +2 -0
  65. package/dist/cli-bundle/chunks/{create-RLLCBCXM.js → create-TG67IVFI.js} +2 -2
  66. package/dist/cli-bundle/chunks/delete-6XKUVVQN.js +2 -0
  67. package/dist/cli-bundle/chunks/{deps-J4ONTF4X.js → deps-AJUGP2OH.js} +2 -2
  68. package/dist/cli-bundle/chunks/{docs-YL2DJ4WD.js → docs-QOCLDRKJ.js} +2 -2
  69. package/dist/cli-bundle/chunks/{files-NGNAIYKK.js → files-3ST5TY64.js} +2 -2
  70. package/dist/cli-bundle/chunks/focus-R2AWS63Y.js +2 -0
  71. package/dist/cli-bundle/chunks/{history-compact-HW62K5XP.js → history-compact-7BJFML4S.js} +2 -2
  72. package/dist/cli-bundle/chunks/{history-redact-HVBKUJOW.js → history-redact-WJN3HYXR.js} +2 -2
  73. package/dist/cli-bundle/chunks/{history-repair-OPNBH5JJ.js → history-repair-XDNZUB7F.js} +2 -2
  74. package/dist/cli-bundle/chunks/{learnings-F36PZXT6.js → learnings-SZMUPVNA.js} +2 -2
  75. package/dist/cli-bundle/chunks/{profile-N3XMWBM7.js → profile-KL53JIAC.js} +2 -2
  76. package/dist/cli-bundle/chunks/{register-list-query-BKGHBI7Y.js → register-list-query-QH7ONPKU.js} +2 -2
  77. package/dist/cli-bundle/chunks/register-mutation-OCRQNZK4.js +20 -0
  78. package/dist/cli-bundle/chunks/register-operations-HIBJXRGB.js +2 -0
  79. package/dist/cli-bundle/chunks/register-setup-QWBQ6HBS.js +2 -0
  80. package/dist/cli-bundle/chunks/restore-FXA5QPM7.js +2 -0
  81. package/dist/cli-bundle/chunks/{schema-4PJQMGUY.js → schema-QJ27OTRV.js} +2 -2
  82. package/dist/cli-bundle/chunks/update-7GBO4SXG.js +2 -0
  83. package/dist/cli-bundle/chunks/update-many-VF6ZKQUO.js +2 -0
  84. package/dist/cli-bundle/focused-chunks/chunk-27DK4A5O.js +2 -0
  85. package/dist/cli-bundle/focused-chunks/chunk-4JC3AOGS.js +8 -0
  86. package/dist/cli-bundle/focused-chunks/chunk-6KDHXURF.js +2 -0
  87. package/dist/cli-bundle/focused-chunks/chunk-74CWP3A4.js +2 -0
  88. package/dist/cli-bundle/focused-chunks/chunk-7AZDTGPA.js +2 -0
  89. package/dist/cli-bundle/focused-chunks/chunk-7YTZ7A4E.js +2 -0
  90. package/dist/cli-bundle/focused-chunks/{chunk-ONIX2KKW.js → chunk-CL3NB7VW.js} +2 -2
  91. package/dist/cli-bundle/focused-chunks/chunk-EAXXF2HW.js +4 -0
  92. package/dist/cli-bundle/focused-chunks/{chunk-L6A4NVQC.js → chunk-EYO4F74Z.js} +2 -2
  93. package/dist/cli-bundle/focused-chunks/chunk-GEYU23YS.js +153 -0
  94. package/dist/cli-bundle/focused-chunks/{chunk-DQ4PLKEE.js → chunk-GIERI4YU.js} +2 -2
  95. package/dist/cli-bundle/focused-chunks/chunk-GSW2Y7VZ.js +5 -0
  96. package/dist/cli-bundle/focused-chunks/{chunk-WVGJAD7L.js → chunk-LKQXXO62.js} +2 -2
  97. package/dist/cli-bundle/focused-chunks/{chunk-UFCPSWIL.js → chunk-MBBMTDD3.js} +2 -2
  98. package/dist/cli-bundle/focused-chunks/{chunk-OYTK4VNH.js → chunk-ME4XVOBJ.js} +2 -2
  99. package/dist/cli-bundle/focused-chunks/{chunk-RO5BQFG3.js → chunk-N7QN3NE6.js} +2 -2
  100. package/dist/cli-bundle/focused-chunks/chunk-QL5H3AQH.js +2 -0
  101. package/dist/cli-bundle/focused-chunks/chunk-TQMFQYXR.js +29 -0
  102. package/dist/cli-bundle/focused-chunks/{chunk-SQXVGHMH.js → chunk-XNVXIQ4B.js} +2 -2
  103. package/dist/cli-bundle/focused-chunks/{chunk-BOGRY7M6.js → chunk-YHDCGUIW.js} +10 -10
  104. package/dist/cli-bundle/focused-chunks/{chunk-K37BB4JL.js → chunk-YLPZHWX7.js} +2 -2
  105. package/dist/cli-bundle/main.js +13 -13
  106. package/dist/cli-bundle/sdk-authoring.js +1 -1
  107. package/dist/cli-bundle/sdk-contracts.js +1 -1
  108. package/dist/cli-bundle/sdk-core.js +28 -28
  109. package/dist/cli-bundle/sdk-governance.js +1 -1
  110. package/dist/cli-bundle/sdk-graph.js +1 -1
  111. package/dist/cli-bundle/sdk-merge.js +1 -1
  112. package/dist/cli-bundle/sdk-query.js +1 -1
  113. package/dist/cli-bundle/sdk-runtime.js +1 -1
  114. package/dist/cli-bundle/sdk-testing.js +1 -1
  115. package/dist/cli-bundle/sdk.js +1 -1
  116. package/dist/core/extensions/activation-summary.d.ts +4 -0
  117. package/dist/core/extensions/activation-summary.js +5 -2
  118. package/dist/core/extensions/contribution-inventory.d.ts +1 -0
  119. package/dist/core/extensions/contribution-inventory.js +35 -2
  120. package/dist/core/extensions/extension-hook-runtime.js +5 -3
  121. package/dist/core/extensions/extension-types.d.ts +18 -1
  122. package/dist/core/extensions/extension-types.js +2 -2
  123. package/dist/core/extensions/loader.js +8 -13
  124. package/dist/core/extensions/preflight-ownership.d.ts +5 -0
  125. package/dist/core/extensions/preflight-ownership.js +42 -0
  126. package/dist/core/item/item-format.js +14 -20
  127. package/dist/core/shared/constants.js +3 -2
  128. package/dist/core/store/item-store.js +2 -2
  129. package/dist/core/store/settings.js +2 -2
  130. package/dist/mcp/server.js +12 -6
  131. package/dist/mcp/tool-definitions.js +14 -7
  132. package/dist/sdk/cli-contracts/agent-output-contracts.d.ts +18 -18
  133. package/dist/sdk/cli-contracts/agent-output-contracts.js +51 -23
  134. package/dist/sdk/cli-contracts/commander-mutation-options.js +26 -2
  135. package/dist/sdk/cli-contracts/flag-contracts.d.ts +4 -0
  136. package/dist/sdk/cli-contracts/flag-contracts.js +34 -2
  137. package/dist/sdk/cli-contracts/registration-helpers.js +4 -2
  138. package/dist/sdk/cli-contracts/runtime-contracts.d.ts +10 -2
  139. package/dist/sdk/cli-contracts/runtime-contracts.js +21 -5
  140. package/dist/sdk/cli-contracts/tool-schema.js +4 -2
  141. package/dist/sdk/cli-contracts.d.ts +2 -2
  142. package/dist/sdk/cli-contracts.js +4 -4
  143. package/dist/sdk/cli-program.js +3 -3
  144. package/dist/sdk/compose.d.ts +2 -2
  145. package/dist/sdk/compose.js +7 -2
  146. package/dist/sdk/contracts.d.ts +1 -0
  147. package/dist/sdk/contracts.js +3 -2
  148. package/dist/sdk/define.d.ts +3 -1
  149. package/dist/sdk/define.js +3 -8
  150. package/dist/sdk/dependency-provenance.d.ts +2 -0
  151. package/dist/sdk/dependency-provenance.js +7 -3
  152. package/dist/sdk/error-code-catalog.d.ts +23 -0
  153. package/dist/sdk/error-code-catalog.js +25 -5
  154. package/dist/sdk/extension/install-sources.d.ts +43 -5
  155. package/dist/sdk/extension/install-sources.js +36 -2
  156. package/dist/sdk/extension/migrations.d.ts +114 -0
  157. package/dist/sdk/extension/migrations.js +175 -0
  158. package/dist/sdk/extension/scaffold.js +14 -9
  159. package/dist/sdk/extension/source-resolution.d.ts +50 -0
  160. package/dist/sdk/extension/source-resolution.js +66 -0
  161. package/dist/sdk/extension.d.ts +5 -1
  162. package/dist/sdk/extension.js +24 -26
  163. package/dist/sdk/generated-error-code-catalog.js +499 -3
  164. package/dist/sdk/governance/health.js +11 -2
  165. package/dist/sdk/graph/governance.js +3 -3
  166. package/dist/sdk/graph/remediation.js +3 -3
  167. package/dist/sdk/graph/run.js +4 -8
  168. package/dist/sdk/index.d.ts +7 -2
  169. package/dist/sdk/index.js +9 -4
  170. package/dist/sdk/item-transaction.d.ts +51 -6
  171. package/dist/sdk/item-transaction.js +132 -22
  172. package/dist/sdk/lifecycle/create.d.ts +4 -0
  173. package/dist/sdk/lifecycle/create.js +26 -10
  174. package/dist/sdk/lifecycle-policy.d.ts +9 -0
  175. package/dist/sdk/lifecycle-policy.js +22 -9
  176. package/dist/sdk/merge/driver.js +6 -3
  177. package/dist/sdk/output-contracts.d.ts +67 -0
  178. package/dist/sdk/output-contracts.js +173 -0
  179. package/dist/sdk/package-import-adapters.js +2 -2
  180. package/dist/sdk/package-migrations.d.ts +10 -0
  181. package/dist/sdk/package-migrations.js +21 -0
  182. package/dist/sdk/runtime.d.ts +2 -0
  183. package/dist/sdk/runtime.js +6 -2
  184. package/dist/sdk/structured-mutations.d.ts +23 -0
  185. package/dist/sdk/structured-mutations.js +219 -10
  186. package/dist/sdk/workspace-snapshot.js +58 -12
  187. package/dist/sdk/workspace.js +30 -4
  188. package/docs/COMMANDS.md +49 -10
  189. package/docs/EXTENSIONS.md +3 -3
  190. package/docs/EXTENSION_LIFECYCLE.md +46 -0
  191. package/docs/MERGE_SAFETY.md +2 -0
  192. package/docs/PR_REVIEW_LOOP.md +10 -4
  193. package/docs/README.md +23 -22
  194. package/docs/RELEASING.md +36 -23
  195. package/docs/SCRIPTING.md +32 -9
  196. package/docs/SDK.md +122 -14
  197. package/docs/SELF_DESCRIBING_CONTEXT_CONTRACTS.md +13 -0
  198. package/docs/TESTING.md +25 -0
  199. package/docs/examples/sdk-contract-consumer/README.md +11 -1
  200. package/docs/examples/sdk-contract-consumer/package.json +2 -1
  201. package/docs/examples/sdk-contract-consumer/parse-receipt.mjs +22 -0
  202. package/marketplace.json +2 -2
  203. package/package.json +5 -4
  204. package/packages/pm-beads/package.json +1 -1
  205. package/packages/pm-calendar/package.json +1 -1
  206. package/packages/pm-command-kit/package.json +1 -1
  207. package/packages/pm-digital-twin/package.json +1 -1
  208. package/packages/pm-governance-audit/package.json +1 -1
  209. package/packages/pm-guide-shell/package.json +1 -1
  210. package/packages/pm-kanban/package.json +1 -1
  211. package/packages/pm-lifecycle-hooks/package.json +1 -1
  212. package/packages/pm-linked-test-adapters/package.json +1 -1
  213. package/packages/pm-search-advanced/package.json +1 -1
  214. package/packages/pm-templates/package.json +1 -1
  215. package/packages/pm-todos/package.json +1 -1
  216. package/packages/pm-vcs/package.json +1 -1
  217. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  218. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  219. package/sdk/public-surface.json +508 -32
  220. package/dist/cli-bundle/chunks/append-DHBRLHHS.js +0 -2
  221. package/dist/cli-bundle/chunks/chunk-2INN52SU.js +0 -8
  222. package/dist/cli-bundle/chunks/chunk-377OOXUF.js +0 -55
  223. package/dist/cli-bundle/chunks/chunk-6RSK4IFN.js +0 -20
  224. package/dist/cli-bundle/chunks/chunk-ASJJKA57.js +0 -2
  225. package/dist/cli-bundle/chunks/chunk-IYAVULRN.js +0 -2
  226. package/dist/cli-bundle/chunks/chunk-JDPKBV5P.js +0 -2
  227. package/dist/cli-bundle/chunks/chunk-RRQBHQOV.js +0 -2
  228. package/dist/cli-bundle/chunks/chunk-SULWTPQO.js +0 -8
  229. package/dist/cli-bundle/chunks/chunk-V5K52PYW.js +0 -164
  230. package/dist/cli-bundle/chunks/chunk-XBLOD5TZ.js +0 -2
  231. package/dist/cli-bundle/chunks/close-VLHNN6YB.js +0 -2
  232. package/dist/cli-bundle/chunks/close-many-LSJNZKU6.js +0 -2
  233. package/dist/cli-bundle/chunks/comments-AAIA6A6X.js +0 -2
  234. package/dist/cli-bundle/chunks/copy-Z7YMLEHN.js +0 -2
  235. package/dist/cli-bundle/chunks/delete-KNOHHQJM.js +0 -2
  236. package/dist/cli-bundle/chunks/focus-LFRCGALV.js +0 -2
  237. package/dist/cli-bundle/chunks/register-mutation-GU3DCECN.js +0 -20
  238. package/dist/cli-bundle/chunks/register-operations-PTWH727R.js +0 -2
  239. package/dist/cli-bundle/chunks/register-setup-KWV6UD77.js +0 -2
  240. package/dist/cli-bundle/chunks/restore-4HZSLILR.js +0 -2
  241. package/dist/cli-bundle/chunks/update-E6LPS5IV.js +0 -2
  242. package/dist/cli-bundle/chunks/update-many-OSIC6KRO.js +0 -2
  243. package/dist/cli-bundle/focused-chunks/chunk-2VIIXOAD.js +0 -2
  244. package/dist/cli-bundle/focused-chunks/chunk-5MTKO7TV.js +0 -153
  245. package/dist/cli-bundle/focused-chunks/chunk-6GIZK7VQ.js +0 -2
  246. package/dist/cli-bundle/focused-chunks/chunk-AOP2WIZZ.js +0 -2
  247. package/dist/cli-bundle/focused-chunks/chunk-C2QSL62X.js +0 -28
  248. package/dist/cli-bundle/focused-chunks/chunk-CL75YW32.js +0 -2
  249. package/dist/cli-bundle/focused-chunks/chunk-E7OFMWGT.js +0 -8
  250. package/dist/cli-bundle/focused-chunks/chunk-I5F5UK3Q.js +0 -2
  251. package/dist/cli-bundle/focused-chunks/chunk-QM2BIVK7.js +0 -4
  252. package/dist/cli-bundle/focused-chunks/chunk-T5TSY36R.js +0 -5
  253. package/dist/cli-bundle/focused-chunks/chunk-VT6BF2IX.js +0 -2
@@ -4,9 +4,9 @@
4
4
  * Implements the pm create command surface and its agent-facing runtime behavior.
5
5
  */
6
6
 
7
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="5f01dc2b-6239-5724-aa36-8f81b580b76a")}catch(e){}}();
7
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="93dc76a3-f205-5a44-85bd-5a6fad80c8d4")}catch(e){}}();
8
8
  import { pathExists, removeFileIfExists, writeFileAtomic, appendHistoryEntry, createHistoryEntry, generateItemId, normalizeItemId, canonicalDocument, normalizeItemMetadata, serializeItemDocument, assertParentReferenceIsNotSelf, isPlaceholderReferenceToken, normalizeParentReferenceValue, validateMissingParentReference, validateSprintOrReleaseValue, assertNoUnknownCsvKeys, createStdinTokenResolver, looksLikeGenericKeyValueEntry, mergeAdditiveTags, parseCsvKv, parseOptionalNonNegativeInteger, parseOptionalNumber, parseTags, resolvePriority, getFocusedItem, normalizeStatusInput, canonicalizeCommandOptionKey, commandOptionFlagLabel, resolveItemTypeRegistry, resolveCommandOptionPolicyState, resolveTypeDefinition, resolveTypeName, validateTypeOptions, acquireLock, printError, buildInvalidTypeError, resolveTypeSynonym, collectRuntimeCreateFieldValues, resolveItemTypesFilePath, resolveRuntimeFieldRegistry, resolveRuntimeStatusRegistry, EXIT_CODE, ITEM_METADATA_KEY_ORDER, PmCliError, nowIso, resolveIsoOrRelative, getActiveExtensionRegistrations, projectAfterCommandItemSnapshot, recordAfterCommandAffectedItem, runActiveCommandHandler, runActiveBeforeMutationHooks, runActiveOnWriteHooks, collectRegisteredItemFieldNames, applyRegisteredItemFieldDefaultsAndValidation, parseRegisteredItemFieldAssignments, listAllItemMetadataLight, locateItem, createMutationGuardSdk, getHistoryPath, getItemPath, getSettingsPath, resolvePmRoot, readSettings, resolveAuthor, } from "../runtime-primitives.js";
9
- import { requireTerminalReason } from "../lifecycle-policy.js";
9
+ import { requireTerminalReasonWithRecovery } from "../lifecycle-policy.js";
10
10
  import { evaluateSimilarityGovernance, similarityAdvisoryWarnings, } from "../similarity.js";
11
11
  import { acquireItemMetadataDerivedIndexLock, refreshItemMetadataDerivedIndex, } from "../item-metadata-index.js";
12
12
  import { collectNewOrderingCycleWarnings } from "../graph/mutation-advisory.js";
@@ -1384,13 +1384,28 @@ function resolveCreateOrder(unsetKeys, resolvedOptions) {
1384
1384
  return order;
1385
1385
  }
1386
1386
  /** Resolve an author-controlled reason for an item created directly in the close status. */
1387
- function resolveCreateCloseReason(status, statusRegistry, settings, resolvedOptions, resolution) {
1388
- if (status !== statusRegistry.close_status ||
1389
- !settings.governance.require_close_reason) {
1390
- return { closeReason: undefined, warnings: [] };
1387
+ function resolveCreateCloseReason(status, statusRegistry, settings, resolvedOptions, resolution, nowValue) {
1388
+ if (resolvedOptions.completedAt !== undefined &&
1389
+ status !== statusRegistry.close_status) {
1390
+ throw new PmCliError("--completed-at requires a terminal create status.", EXIT_CODE.USAGE);
1391
1391
  }
1392
+ const completedAt = status !== statusRegistry.close_status
1393
+ ? undefined
1394
+ : resolvedOptions.completedAt === undefined
1395
+ ? nowValue
1396
+ : resolveIsoOrRelative(resolvedOptions.completedAt, new Date(nowValue), "completed-at");
1397
+ if (status !== statusRegistry.close_status) {
1398
+ return { closeReason: undefined, completedAt, warnings: [] };
1399
+ }
1400
+ const reasonInput = settings.governance.require_close_reason
1401
+ ? {
1402
+ explicit: resolvedOptions.closeReason ?? resolvedOptions.message,
1403
+ resolution,
1404
+ }
1405
+ : { explicit: resolvedOptions.closeReason };
1392
1406
  return {
1393
- closeReason: requireTerminalReason({ explicit: resolvedOptions.message, resolution }, true).closeReason,
1407
+ closeReason: requireTerminalReasonWithRecovery(reasonInput, settings.governance.require_close_reason, { operation: "create", status }).closeReason,
1408
+ completedAt,
1394
1409
  warnings: [],
1395
1410
  };
1396
1411
  }
@@ -1671,9 +1686,10 @@ export async function runCreate(options, global) {
1671
1686
  // GH-249: creating an item directly in the close status must honor
1672
1687
  // governance.require_close_reason, just like `pm close` (errors when missing)
1673
1688
  // and `pm update --status closed` (defaults + warns).
1674
- const closeReasonResolution = resolveCreateCloseReason(status, statusRegistry, settings, resolvedOptions, resolution);
1689
+ const closeReasonResolution = resolveCreateCloseReason(status, statusRegistry, settings, resolvedOptions, resolution, nowValue);
1675
1690
  const closeReason = closeReasonResolution.closeReason;
1676
1691
  const closedAt = status === statusRegistry.close_status ? nowValue : undefined;
1692
+ const completedAt = closeReasonResolution.completedAt;
1677
1693
  validationWarnings.push(...closeReasonResolution.warnings);
1678
1694
  const itemMetadata = normalizeItemMetadata({
1679
1695
  id,
@@ -1683,7 +1699,7 @@ export async function runCreate(options, global) {
1683
1699
  type_options: validatedTypeOptions.normalized,
1684
1700
  status,
1685
1701
  closed_at: closedAt,
1686
- completed_at: closedAt,
1702
+ completed_at: completedAt,
1687
1703
  close_reason: closeReason,
1688
1704
  priority,
1689
1705
  tags,
@@ -1825,4 +1841,4 @@ export const _testOnlyCreateCommand = {
1825
1841
  typeOptionExampleValue,
1826
1842
  };
1827
1843
  //# sourceMappingURL=create.js.map
1828
- //# debugId=5f01dc2b-6239-5724-aa36-8f81b580b76a
1844
+ //# debugId=93dc76a3-f205-5a44-85bd-5a6fad80c8d4
@@ -58,6 +58,13 @@ export interface TerminalReasonResolution {
58
58
  /** Field that supplied the resolved reason. */
59
59
  source: TerminalReasonSource;
60
60
  }
61
+ /** Presentation context used to make terminal-policy recovery actionable. */
62
+ export interface TerminalReasonRecoveryContext {
63
+ /** Operation whose input failed terminal-reason governance. */
64
+ operation: "close" | "create";
65
+ /** Terminal status requested by a create operation. */
66
+ status?: string;
67
+ }
61
68
  /** Result of applying ordering-edge lifecycle policy to mutable item metadata. */
62
69
  export interface TerminalOrderingMutation {
63
70
  /** Metadata fields changed by the policy. */
@@ -71,6 +78,8 @@ export declare const DEFAULT_TERMINAL_TRANSITION_POLICY: Readonly<TerminalTransi
71
78
  export declare function resolveTerminalReason(input: TerminalReasonInput): TerminalReasonResolution;
72
79
  /** Enforce close-reason governance without inventing immutable history content. */
73
80
  export declare function requireTerminalReason(input: TerminalReasonInput, required: boolean): TerminalReasonResolution;
81
+ /** Enforce close-reason governance with recovery for a specific operation. */
82
+ export declare function requireTerminalReasonWithRecovery(input: TerminalReasonInput, required: boolean, recovery: TerminalReasonRecoveryContext): TerminalReasonResolution;
74
83
  /**
75
84
  * Apply terminal ordering policy while clearing only transient blocked-state
76
85
  * scalars. Preserving `blocked_by` dependency rows keeps predecessor history
@@ -5,7 +5,7 @@
5
5
  * item enters a terminal lifecycle state.
6
6
  */
7
7
 
8
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="1433b857-3f29-5ef7-a5b3-8a70584df054")}catch(e){}}();
8
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="a7ae3c89-b50b-5e4f-8273-8318bc976d84")}catch(e){}}();
9
9
  import { EXIT_CODE } from "../core/shared/constants.js";
10
10
  import { PmCliError } from "../core/shared/errors.js";
11
11
  /** Default terminal policy shared by CLI, SDK, and MCP operations. */
@@ -36,22 +36,35 @@ export function resolveTerminalReason(input) {
36
36
  }
37
37
  /** Enforce close-reason governance without inventing immutable history content. */
38
38
  export function requireTerminalReason(input, required) {
39
+ return requireTerminalReasonWithRecovery(input, required, {
40
+ operation: "close",
41
+ });
42
+ }
43
+ /** Enforce close-reason governance with recovery for a specific operation. */
44
+ export function requireTerminalReasonWithRecovery(input, required, recovery) {
39
45
  const resolution = resolveTerminalReason(input);
40
46
  if (!required || resolution.closeReason !== undefined) {
41
47
  return resolution;
42
48
  }
43
- throw new PmCliError("Close reason text is required because governance.require_close_reason is enabled", EXIT_CODE.USAGE, {
44
- code: "close_reason_required",
45
- required: "Provide an author-controlled closing summary as the reason, message, resolution, or duplicate target.",
46
- why: "governance.require_close_reason is enabled, so tools must not invent immutable closure evidence.",
47
- examples: [
49
+ const examples = recovery.operation === "create"
50
+ ? [
51
+ `pm create --title "<title>" --type <type> --status ${recovery.status ?? "closed"} --close-reason "<closing summary>"`,
52
+ `pm create --title "<title>" --type <type> --status ${recovery.status ?? "closed"} --resolution "<resolution summary>"`,
53
+ `pm create --stdin-json < item.json`,
54
+ ]
55
+ : [
48
56
  'pm close <id> "Done: <what changed and why>"',
49
57
  'pm close <id> --reason "<closing summary>"',
50
58
  'pm close <id> -m "<closing summary>"',
51
59
  "pm close <id> --duplicate-of <canonical-id>",
52
- ],
60
+ ];
61
+ throw new PmCliError("Close reason text is required because governance.require_close_reason is enabled", EXIT_CODE.USAGE, {
62
+ code: "close_reason_required",
63
+ required: "Provide an author-controlled closing summary as the reason, message, resolution, or duplicate target.",
64
+ why: "governance.require_close_reason is enabled, so tools must not invent immutable closure evidence.",
65
+ examples,
53
66
  nextSteps: [
54
- "Re-run the terminal transition with a closing summary.",
67
+ `Re-run the ${recovery.operation} operation with a closing summary.`,
55
68
  "To stop requiring reasons, run: pm config set governance-require-close-reason --policy disabled",
56
69
  ],
57
70
  });
@@ -105,4 +118,4 @@ export function applyTerminalOrderingPolicy(metadata, policy) {
105
118
  };
106
119
  }
107
120
  //# sourceMappingURL=lifecycle-policy.js.map
108
- //# debugId=1433b857-3f29-5ef7-a5b3-8a70584df054
121
+ //# debugId=a7ae3c89-b50b-5e4f-8273-8318bc976d84
@@ -9,7 +9,7 @@
9
9
  * merge never corrupts tracker storage the way raw conflict markers do.
10
10
  */
11
11
 
12
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="9426a3fa-19bd-598f-90f6-df26a03bd9eb")}catch(e){}}();
12
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="182fee45-4de8-502d-8aec-84b5b8e4aecb")}catch(e){}}();
13
13
  import { readFile, writeFile } from "node:fs/promises";
14
14
  import path from "node:path";
15
15
  import { getActiveExtensionRegistrations } from "../../core/extensions/index.js";
@@ -164,7 +164,10 @@ export async function runMergeDriver(options, global) {
164
164
  }
165
165
  const guidance = [];
166
166
  if (conflicts.length > 0) {
167
- guidance.push(`Both branches changed ${conflicts.join(", ")}; the ${preferred} value was kept. Review the merged file, re-apply the losing change if needed, then "git add" it.`);
167
+ const receiptGuidance = result.receipt === undefined
168
+ ? 'Run "pm merge report" to inspect clone-local merge evidence.'
169
+ : `Run "pm merge report" and correlate receipt ${result.receipt.receipt_id} with item ${result.receipt.item_id}; clone-local discarded values are never copied into this result.`;
170
+ guidance.push(`Both branches changed ${conflicts.join(", ")}; the ${preferred} value was kept. ${receiptGuidance} Review the merged file, re-apply the losing change if needed, then "git add" it.`);
168
171
  }
169
172
  if (artifact === "history" && result.history?.reanchored) {
170
173
  guidance.push('The merged history chain was re-anchored. Run "pm validate --check-history-drift" and "pm history-repair --all" after the merge to reconcile item state with merged history.');
@@ -181,4 +184,4 @@ export async function runMergeDriver(options, global) {
181
184
  };
182
185
  }
183
186
  //# sourceMappingURL=driver.js.map
184
- //# debugId=9426a3fa-19bd-598f-90f6-df26a03bd9eb
187
+ //# debugId=182fee45-4de8-502d-8aec-84b5b8e4aecb
@@ -0,0 +1,67 @@
1
+ /** Stable machine-readable result families used across pm transports. */
2
+ export declare const PM_OUTPUT_ENVELOPE_KINDS: readonly ["mutation_receipt", "entity", "collection", "diagnostic", "stream"];
3
+ /** Restricts portable result-envelope families. */
4
+ export type PmOutputEnvelopeKind = (typeof PM_OUTPUT_ENVELOPE_KINDS)[number];
5
+ /** Describes how one command exposes its default machine-readable result. */
6
+ export interface PmCommandOutputEnvelopeContract {
7
+ /** Canonical command path. */
8
+ command: string;
9
+ /** Semantic result family. */
10
+ kind: PmOutputEnvelopeKind;
11
+ /** Root key carrying the primary value, or null for a flat receipt/stream. */
12
+ wrapper_key: string | null;
13
+ /** Whether the output can carry multiple primary rows. */
14
+ cardinality: "one" | "many" | "none";
15
+ /** Stable format-flag spelling accepted by every command. */
16
+ format_flag: "--json";
17
+ }
18
+ /** Normalized SDK representation of the flat CLI mutation receipt. */
19
+ export interface PmMutationReceipt {
20
+ /** Mutated item or plan identifier. */
21
+ id: string;
22
+ /** Resulting lifecycle status or deletion outcome. */
23
+ status: string;
24
+ /** Number of fields changed by the mutation. */
25
+ changedFieldCount: number;
26
+ /** Persisted close reason when the command closed work. */
27
+ closeReason?: string;
28
+ /** Whether a destructive mutation removed its target. */
29
+ deleted?: boolean;
30
+ /** Status before the mutation when the command reports it. */
31
+ previousStatus?: string;
32
+ /** Non-fatal mutation warnings retained by the transport. */
33
+ warnings?: readonly unknown[];
34
+ }
35
+ /** Wire representation emitted by CLI mutation commands in JSON mode. */
36
+ export interface PmCliMutationReceipt {
37
+ /** Mutated item or plan identifier. */
38
+ id: string;
39
+ /** Resulting lifecycle status or deletion outcome. */
40
+ status: string;
41
+ /** Number of fields changed by the mutation. */
42
+ changed_field_count: number;
43
+ /** Persisted close reason when the command closed work. */
44
+ close_reason?: string;
45
+ /** Whether a destructive mutation removed its target. */
46
+ deleted?: boolean;
47
+ /** Status before the mutation when the command reports it. */
48
+ previous_status?: string;
49
+ /** Non-fatal mutation warnings retained by the transport. */
50
+ warnings?: readonly unknown[];
51
+ }
52
+ /** Validate and preserve one package-authored output-envelope declaration. */
53
+ export declare function definePmCommandOutputEnvelope<TContract extends PmCommandOutputEnvelopeContract>(contract: TContract): TContract;
54
+ /** Default envelope declaration for every built-in command. */
55
+ export declare const PM_COMMAND_OUTPUT_ENVELOPE_CONTRACTS: PmCommandOutputEnvelopeContract[];
56
+ /** Resolve a built-in envelope or generate a conservative package fallback. */
57
+ export declare function resolvePmCommandOutputEnvelope(command: string): PmCommandOutputEnvelopeContract;
58
+ /** Return whether an unknown value is the flat CLI mutation receipt shape. */
59
+ export declare function isPmMutationReceipt(value: unknown): value is PmCliMutationReceipt;
60
+ /**
61
+ * Parse and normalize the flat JSON receipt emitted by mutation commands.
62
+ * Wrapped read envelopes are rejected so a wrong consumer assumption fails at
63
+ * the integration boundary instead of silently returning an undefined id.
64
+ */
65
+ export declare function parseMutationReceipt(json: string): PmMutationReceipt;
66
+ /** Parse and normalize an already decoded mutation receipt value. */
67
+ export declare function parseMutationReceipt(value: unknown): PmMutationReceipt;
@@ -0,0 +1,173 @@
1
+ /**
2
+ * @module sdk/output-contracts
3
+ *
4
+ * Defines portable result-envelope contracts and safe mutation receipt parsing
5
+ * for CLI, SDK, MCP, and package consumers.
6
+ */
7
+
8
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="af86d275-63a8-5205-a8b3-154efdbd8e2a")}catch(e){}}();
9
+ import { PM_CORE_COMMAND_NAMES } from "./cli-contracts/enum-contracts.js";
10
+ /** Stable machine-readable result families used across pm transports. */
11
+ export const PM_OUTPUT_ENVELOPE_KINDS = [
12
+ "mutation_receipt",
13
+ "entity",
14
+ "collection",
15
+ "diagnostic",
16
+ "stream",
17
+ ];
18
+ const MUTATION_COMMANDS = new Set([
19
+ "append",
20
+ "claim",
21
+ "close",
22
+ "close-task",
23
+ "copy",
24
+ "create",
25
+ "delete",
26
+ "focus",
27
+ "pause-task",
28
+ "release",
29
+ "restore",
30
+ "start-task",
31
+ "update",
32
+ ]);
33
+ const COLLECTION_MUTATION_COMMANDS = new Set(["close-many", "update-many"]);
34
+ const COLLECTION_COMMANDS = new Set([
35
+ "activity",
36
+ "comments",
37
+ "contracts",
38
+ "events",
39
+ "history",
40
+ "learnings",
41
+ "list",
42
+ "notes",
43
+ "search",
44
+ ]);
45
+ const DIAGNOSTIC_COMMANDS = new Set([
46
+ "aggregate",
47
+ "deps",
48
+ "graph",
49
+ "health",
50
+ "stats",
51
+ "validate",
52
+ ]);
53
+ /** Validate and preserve one package-authored output-envelope declaration. */
54
+ export function definePmCommandOutputEnvelope(contract) {
55
+ if (contract.command.trim().length === 0) {
56
+ throw new TypeError("command must be a non-empty command path");
57
+ }
58
+ if (!PM_OUTPUT_ENVELOPE_KINDS.includes(contract.kind)) {
59
+ throw new TypeError(`Unsupported output envelope kind: ${contract.kind}`);
60
+ }
61
+ return contract;
62
+ }
63
+ function createOutputEnvelopeContract(command) {
64
+ const normalizedCommand = command.trim().replace(/\s+/gu, " ");
65
+ const [rootCommand = normalizedCommand] = normalizedCommand.split(" ");
66
+ if (COLLECTION_MUTATION_COMMANDS.has(rootCommand)) {
67
+ return definePmCommandOutputEnvelope({
68
+ command: normalizedCommand,
69
+ kind: "collection",
70
+ wrapper_key: "rows",
71
+ cardinality: "many",
72
+ format_flag: "--json",
73
+ });
74
+ }
75
+ if (MUTATION_COMMANDS.has(rootCommand)) {
76
+ return definePmCommandOutputEnvelope({
77
+ command: normalizedCommand,
78
+ kind: "mutation_receipt",
79
+ wrapper_key: null,
80
+ cardinality: "one",
81
+ format_flag: "--json",
82
+ });
83
+ }
84
+ if (COLLECTION_COMMANDS.has(rootCommand)) {
85
+ return definePmCommandOutputEnvelope({
86
+ command: normalizedCommand,
87
+ kind: "collection",
88
+ wrapper_key: rootCommand === "contracts" ? null : "items",
89
+ cardinality: "many",
90
+ format_flag: "--json",
91
+ });
92
+ }
93
+ if (DIAGNOSTIC_COMMANDS.has(rootCommand)) {
94
+ return definePmCommandOutputEnvelope({
95
+ command: normalizedCommand,
96
+ kind: "diagnostic",
97
+ wrapper_key: null,
98
+ cardinality: "none",
99
+ format_flag: "--json",
100
+ });
101
+ }
102
+ return definePmCommandOutputEnvelope({
103
+ command: normalizedCommand,
104
+ kind: rootCommand === "get" ? "entity" : "diagnostic",
105
+ wrapper_key: rootCommand === "get" ? "item" : null,
106
+ cardinality: rootCommand === "get" ? "one" : "none",
107
+ format_flag: "--json",
108
+ });
109
+ }
110
+ /** Default envelope declaration for every built-in command. */
111
+ export const PM_COMMAND_OUTPUT_ENVELOPE_CONTRACTS = PM_CORE_COMMAND_NAMES.map((command) => createOutputEnvelopeContract(command));
112
+ const OUTPUT_ENVELOPE_BY_COMMAND = new Map(PM_COMMAND_OUTPUT_ENVELOPE_CONTRACTS.map((contract) => [contract.command, contract]));
113
+ /** Resolve a built-in envelope or generate a conservative package fallback. */
114
+ export function resolvePmCommandOutputEnvelope(command) {
115
+ const normalized = command.trim().replace(/\s+/gu, " ");
116
+ if (normalized.length === 0) {
117
+ throw new TypeError("command must be a non-empty command path");
118
+ }
119
+ const [rootCommand = normalized] = normalized.split(" ");
120
+ const declared = OUTPUT_ENVELOPE_BY_COMMAND.get(rootCommand);
121
+ return declared
122
+ ? { ...declared, command: normalized }
123
+ : createOutputEnvelopeContract(normalized);
124
+ }
125
+ function isRecord(value) {
126
+ return typeof value === "object" && value !== null && !Array.isArray(value);
127
+ }
128
+ /** Return whether an unknown value is the flat CLI mutation receipt shape. */
129
+ export function isPmMutationReceipt(value) {
130
+ return (isRecord(value) &&
131
+ typeof value.id === "string" &&
132
+ value.id.length > 0 &&
133
+ typeof value.status === "string" &&
134
+ value.status.length > 0 &&
135
+ Number.isSafeInteger(value.changed_field_count) &&
136
+ Number(value.changed_field_count) >= 0 &&
137
+ (value.close_reason === undefined ||
138
+ typeof value.close_reason === "string") &&
139
+ (value.deleted === undefined || typeof value.deleted === "boolean") &&
140
+ (value.previous_status === undefined ||
141
+ typeof value.previous_status === "string") &&
142
+ (value.warnings === undefined || Array.isArray(value.warnings)));
143
+ }
144
+ /** Implement string parsing and decoded-value validation at one boundary. */
145
+ export function parseMutationReceipt(input) {
146
+ let value = input;
147
+ if (typeof input === "string") {
148
+ try {
149
+ value = JSON.parse(input);
150
+ }
151
+ catch (error) {
152
+ throw new TypeError(`Mutation receipt must be valid JSON: ${String(error)}`, { cause: error });
153
+ }
154
+ }
155
+ if (!isPmMutationReceipt(value)) {
156
+ throw new TypeError("Mutation receipt must be a flat object with top-level id, status, and changed_field_count fields");
157
+ }
158
+ return {
159
+ id: value.id,
160
+ status: value.status,
161
+ changedFieldCount: value.changed_field_count,
162
+ ...(typeof value.close_reason === "string"
163
+ ? { closeReason: value.close_reason }
164
+ : {}),
165
+ ...(typeof value.deleted === "boolean" ? { deleted: value.deleted } : {}),
166
+ ...(typeof value.previous_status === "string"
167
+ ? { previousStatus: value.previous_status }
168
+ : {}),
169
+ ...(Array.isArray(value.warnings) ? { warnings: value.warnings } : {}),
170
+ };
171
+ }
172
+ //# sourceMappingURL=output-contracts.js.map
173
+ //# debugId=af86d275-63a8-5205-a8b3-154efdbd8e2a
@@ -13,7 +13,7 @@
13
13
  * helper bodies while keeping each package's explicit field mapping in the package.
14
14
  */
15
15
 
16
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="03e4257c-7d89-531b-adb0-664e77e7da18")}catch(e){}}();
16
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="c2567f6a-cd1c-56b5-a93d-41e92ed574bf")}catch(e){}}();
17
17
  import { appendHistoryEntry, createHistoryEntry, } from "../core/history/history.js";
18
18
  import { acquireLock } from "../core/lock/lock.js";
19
19
  import { parseTags } from "../core/item/parse.js";
@@ -442,4 +442,4 @@ export async function commitImportedItem(params) {
442
442
  }
443
443
  }
444
444
  //# sourceMappingURL=package-import-adapters.js.map
445
- //# debugId=03e4257c-7d89-531b-adb0-664e77e7da18
445
+ //# debugId=c2567f6a-cd1c-56b5-a93d-41e92ed574bf
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @module sdk/package-migrations
3
+ *
4
+ * Provides one-shot SDK helpers for extension and package migration lifecycle.
5
+ */
6
+ import { type ExtensionCommandOptions, type ExtensionCommandResult, type PackageCommandOptions, type PackageCommandResult, type PmClientOptions } from "./runtime.js";
7
+ /** Plan or apply active extension migrations without constructing a reusable client. */
8
+ export declare function extensionMigrate(options?: ExtensionCommandOptions, clientOptions?: PmClientOptions): Promise<ExtensionCommandResult>;
9
+ /** Plan or apply active package migrations without constructing a reusable client. */
10
+ export declare function packageMigrate(options?: PackageCommandOptions, clientOptions?: PmClientOptions): Promise<PackageCommandResult>;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @module sdk/package-migrations
3
+ *
4
+ * Provides one-shot SDK helpers for extension and package migration lifecycle.
5
+ */
6
+
7
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="5bbfab95-010d-5507-ab01-f8f43943d295")}catch(e){}}();
8
+ import { PmClient, } from "./runtime.js";
9
+ /** Plan or apply active extension migrations without constructing a reusable client. */
10
+ export function extensionMigrate(options = {}, clientOptions = {}) {
11
+ return new PmClient(clientOptions).extension(undefined, {
12
+ ...options,
13
+ migrate: true,
14
+ });
15
+ }
16
+ /** Plan or apply active package migrations without constructing a reusable client. */
17
+ export function packageMigrate(options = {}, clientOptions = {}) {
18
+ return new PmClient(clientOptions).packageMigrate(options);
19
+ }
20
+ //# sourceMappingURL=package-migrations.js.map
21
+ //# debugId=5bbfab95-010d-5507-ab01-f8f43943d295
@@ -336,6 +336,8 @@ export declare class PmClient {
336
336
  packageActivate(target: string, options?: PackageCommandOptions): Promise<PackageCommandResult>;
337
337
  /** Disable an installed package using the same action as `pm package deactivate`. */
338
338
  packageDeactivate(target: string, options?: PackageCommandOptions): Promise<PackageCommandResult>;
339
+ /** Plan or apply active package migrations with durable workspace receipts. */
340
+ packageMigrate(options?: PackageCommandOptions): Promise<PackageCommandResult>;
339
341
  /** Upgrade the pm CLI and/or managed packages through the public SDK dispatcher. */
340
342
  upgrade(target?: string, options?: UpgradeCommandOptions): Promise<UpgradeResult>;
341
343
  }
@@ -4,7 +4,7 @@
4
4
  * Defines public SDK APIs and package-author helpers for Runtime.
5
5
  */
6
6
 
7
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="196ad1a3-c78f-5eef-90fd-ea5de108b9fa")}catch(e){}}();
7
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="57628397-0652-5a7b-8521-2f0fb2abb787")}catch(e){}}();
8
8
  export { PM_GITIGNORE_END, PM_GITIGNORE_START, ensurePmGitignore, getPmGitignoreBlock, } from "./workspace.js";
9
9
  export { SEARCH_EXTENSION_FLAG_DEFINITIONS } from "./extension-contracts.js";
10
10
  import { AsyncLocalStorage } from "node:async_hooks";
@@ -669,6 +669,10 @@ export class PmClient {
669
669
  packageDeactivate(target, options = {}) {
670
670
  return this.runTyped("package-deactivate", { target, options });
671
671
  }
672
+ /** Plan or apply active package migrations with durable workspace receipts. */
673
+ packageMigrate(options = {}) {
674
+ return this.package(undefined, { ...options, migrate: true });
675
+ }
672
676
  /** Upgrade the pm CLI and/or managed packages through the public SDK dispatcher. */
673
677
  upgrade(target, options = {}) {
674
678
  return this.runTyped("upgrade", {
@@ -1958,4 +1962,4 @@ async function loadWorkspaceExtensionRegistrations(pmRoot, settings, cwd) {
1958
1962
  }
1959
1963
  }
1960
1964
  //# sourceMappingURL=runtime.js.map
1961
- //# debugId=196ad1a3-c78f-5eef-90fd-ea5de108b9fa
1965
+ //# debugId=57628397-0652-5a7b-8521-2f0fb2abb787
@@ -1,4 +1,20 @@
1
1
  import type { BulkItemMutation } from "./item-transaction.js";
2
+ /** Controls for resolving one versioned mutation document. */
3
+ export interface ResolveItemMutationDocumentOptions {
4
+ /** Stable transaction identity used to derive replay-safe create ids. */
5
+ transactionId: string;
6
+ /** Workspace item-id prefix. */
7
+ idPrefix: string;
8
+ }
9
+ /** Fully validated mutation document ready for preview or commit. */
10
+ export interface ResolvedItemMutationDocument {
11
+ /** Versioned structured-input contract. */
12
+ schema_version: 1;
13
+ /** Atomic mutations with every local reference replaced by a concrete id. */
14
+ mutations: BulkItemMutation[];
15
+ /** Batch-local alias to concrete-id receipt. */
16
+ references: Record<string, string>;
17
+ }
2
18
  /** Validated transaction controls shared by atomic CLI and MCP adapters. */
3
19
  export interface AtomicMutationControls {
4
20
  /** Compensation policy applied to created items when a later step fails. */
@@ -12,6 +28,13 @@ export interface AtomicMutationControls {
12
28
  export declare function parseAtomicMutationControls(value: Record<string, unknown>): AtomicMutationControls;
13
29
  /** Parse a JSON array, or an object containing `mutations`, into an atomic mutation batch. */
14
30
  export declare function parseItemMutationBatch(input: string): BulkItemMutation[];
31
+ /**
32
+ * Resolve a versioned heterogeneous mutation document. Create rows may declare
33
+ * a unique `ref`; omitted ids are derived deterministically from the stable
34
+ * transaction id, and `@ref` forward references are supported in target ids,
35
+ * parent/blocked-by options, and dependency entries.
36
+ */
37
+ export declare function resolveItemMutationDocument(input: string, options: ResolveItemMutationDocumentOptions): ResolvedItemMutationDocument;
15
38
  /**
16
39
  * Convert a direct item JSON document or `pm get --json` envelope into the
17
40
  * create/update option shape. Explicit CLI flags override document values.