@unbrained/pm-cli 2026.11.14 → 2026.11.15

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 (234) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/README.md +1 -1
  3. package/dist/cli/extension-command-help.js +2 -2
  4. package/dist/cli-bundle/bundle-manifest.json +1 -1
  5. package/dist/cli-bundle/chunks/chunk-6UTBX62V.js +2 -0
  6. package/dist/cli-bundle/chunks/{chunk-65SBMIK6.js → chunk-7AODVNHX.js} +2 -2
  7. package/dist/cli-bundle/chunks/chunk-ASGAELBQ.js +9 -0
  8. package/dist/cli-bundle/chunks/{chunk-V2OAXGHK.js → chunk-DBUBX4DL.js} +2 -2
  9. package/dist/cli-bundle/chunks/{chunk-547OEGDR.js → chunk-E4B2HWH7.js} +13 -13
  10. package/dist/cli-bundle/chunks/chunk-E74OMFBZ.js +6 -0
  11. package/dist/cli-bundle/chunks/chunk-FSE624WQ.js +2 -0
  12. package/dist/cli-bundle/chunks/chunk-FYOIH56R.js +20 -0
  13. package/dist/cli-bundle/chunks/chunk-GAFALSR2.js +8 -0
  14. package/dist/cli-bundle/chunks/{chunk-AXTUB74T.js → chunk-GCSKHCYK.js} +2 -2
  15. package/dist/cli-bundle/chunks/chunk-HMVZSXB4.js +8 -0
  16. package/dist/cli-bundle/chunks/chunk-IXV5UM4U.js +31 -0
  17. package/dist/cli-bundle/chunks/chunk-J6L3Q5J4.js +3 -0
  18. package/dist/cli-bundle/chunks/chunk-KLWGIEDC.js +114 -0
  19. package/dist/cli-bundle/chunks/chunk-KSLPRST2.js +10 -0
  20. package/dist/cli-bundle/chunks/chunk-LC6DL446.js +3 -0
  21. package/dist/cli-bundle/chunks/{chunk-MELSYAFE.js → chunk-NAX554KY.js} +35 -35
  22. package/dist/cli-bundle/chunks/chunk-PMIGRSNZ.js +2 -0
  23. package/dist/cli-bundle/chunks/chunk-Q6GBRK27.js +3 -0
  24. package/dist/cli-bundle/chunks/chunk-QZNDEZYI.js +2 -0
  25. package/dist/cli-bundle/chunks/chunk-S5UXBECQ.js +2 -0
  26. package/dist/cli-bundle/chunks/{chunk-UJMQP2HP.js → chunk-TESRFVGF.js} +2 -2
  27. package/dist/cli-bundle/chunks/{chunk-EXO4PM5J.js → chunk-VWKLTHYQ.js} +74 -70
  28. package/dist/cli-bundle/chunks/chunk-YJNY5MKP.js +2 -0
  29. package/dist/cli-bundle/chunks/chunk-YLPZE2TK.js +2 -0
  30. package/dist/cli-bundle/chunks/{chunk-RSAN2YUU.js → chunk-ZVDXGAYV.js} +2 -2
  31. package/dist/cli-bundle/chunks/chunk-ZWUS65LN.js +2 -0
  32. package/dist/cli-bundle/chunks/{indexed-receipt-blobs-I6RQGD6Y.js → indexed-receipt-blobs-42Y2CSEQ.js} +2 -2
  33. package/dist/cli-bundle/chunks/item-revision-JCEDTAVX.js +2 -0
  34. package/dist/cli-bundle/chunks/item-transaction-BSMGKZ4S.js +2 -0
  35. package/dist/cli-bundle/chunks/mutation-actor-IQHBRFAJ.js +2 -0
  36. package/dist/cli-bundle/chunks/mutation-admission-DF6BFGG6.js +2 -0
  37. package/dist/cli-bundle/chunks/{register-list-query-MCNOV6ML.js → register-list-query-DNKPQB76.js} +2 -2
  38. package/dist/cli-bundle/chunks/{register-mutation-KYXLYHOK.js → register-mutation-WVTDFLEF.js} +3 -3
  39. package/dist/cli-bundle/chunks/register-operations-NR5MTT5T.js +2 -0
  40. package/dist/cli-bundle/chunks/register-setup-2RTG3LII.js +2 -0
  41. package/dist/cli-bundle/chunks/{settlement-hook-JHXLUBEN.js → settlement-hook-W5ULPKIE.js} +2 -2
  42. package/dist/cli-bundle/chunks/stage-YFNK7U26.js +2 -0
  43. package/dist/cli-bundle/focused-chunks/{chunk-EAYRYXA6.js → chunk-2UQFFVQK.js} +2 -2
  44. package/dist/cli-bundle/focused-chunks/chunk-52H6AELE.js +2 -0
  45. package/dist/cli-bundle/focused-chunks/{chunk-YNYO7PMT.js → chunk-63FM3TIG.js} +6 -6
  46. package/dist/cli-bundle/focused-chunks/{chunk-EH7JKGDH.js → chunk-7GCAZJT4.js} +2 -2
  47. package/dist/cli-bundle/focused-chunks/chunk-BSY6FZ3Y.js +2 -0
  48. package/dist/cli-bundle/focused-chunks/chunk-CZZKAGHE.js +91 -0
  49. package/dist/cli-bundle/focused-chunks/chunk-DRBXOAGY.js +2 -0
  50. package/dist/cli-bundle/focused-chunks/chunk-DXMQ32EH.js +2 -0
  51. package/dist/cli-bundle/focused-chunks/chunk-EALGFJRP.js +78 -0
  52. package/dist/cli-bundle/focused-chunks/chunk-FK2X6MJY.js +44 -0
  53. package/dist/cli-bundle/focused-chunks/{chunk-IDAYTYNN.js → chunk-JE3MFEQZ.js} +2 -2
  54. package/dist/cli-bundle/focused-chunks/{chunk-7KNF6RCV.js → chunk-JRRHN2PZ.js} +12 -12
  55. package/dist/cli-bundle/focused-chunks/chunk-JXA77YIV.js +2 -0
  56. package/dist/cli-bundle/focused-chunks/chunk-LQZ5F6LE.js +3 -0
  57. package/dist/cli-bundle/focused-chunks/chunk-LSWUTTE6.js +6 -0
  58. package/dist/cli-bundle/focused-chunks/chunk-QXOFSZR6.js +3 -0
  59. package/dist/cli-bundle/focused-chunks/{chunk-I7A5VP5E.js → chunk-RMCODWHZ.js} +52 -52
  60. package/dist/cli-bundle/focused-chunks/chunk-S6GTALM4.js +24 -0
  61. package/dist/cli-bundle/focused-chunks/chunk-UPUIDGNJ.js +2 -0
  62. package/dist/cli-bundle/focused-chunks/{chunk-TA4EGVE6.js → chunk-W2KIQ7RF.js} +3 -3
  63. package/dist/cli-bundle/focused-chunks/chunk-WGYR3X6O.js +26 -0
  64. package/dist/cli-bundle/focused-chunks/chunk-WVYXR3YX.js +2 -0
  65. package/dist/cli-bundle/focused-chunks/{chunk-EXCVUBAE.js → chunk-XQZKGTZV.js} +2 -2
  66. package/dist/cli-bundle/focused-chunks/{chunk-3SUKWYR2.js → chunk-YTNUUEY6.js} +2 -2
  67. package/dist/cli-bundle/focused-chunks/chunk-YZUBG4W2.js +6 -0
  68. package/dist/cli-bundle/focused-chunks/chunk-Z6HCQYSW.js +8 -0
  69. package/dist/cli-bundle/focused-chunks/{indexed-receipt-blobs-7XGVHYAO.js → indexed-receipt-blobs-LSBWMXKS.js} +2 -2
  70. package/dist/cli-bundle/focused-chunks/item-revision-YO7YGQYE.js +2 -0
  71. package/dist/cli-bundle/focused-chunks/item-transaction-7A3Q4CAJ.js +2 -0
  72. package/dist/cli-bundle/focused-chunks/mutation-actor-UQHBNHOF.js +2 -0
  73. package/dist/cli-bundle/focused-chunks/mutation-admission-G565NLPE.js +2 -0
  74. package/dist/cli-bundle/focused-chunks/{settlement-hook-H56537UV.js → settlement-hook-UXN76GMA.js} +2 -2
  75. package/dist/cli-bundle/focused-chunks/stage-F3YJGNRK.js +2 -0
  76. package/dist/cli-bundle/main.js +7 -7
  77. package/dist/cli-bundle/sdk-authoring.js +1 -1
  78. package/dist/cli-bundle/sdk-contracts.js +3 -3
  79. package/dist/cli-bundle/sdk-core.js +1 -1
  80. package/dist/cli-bundle/sdk-governance.js +1 -1
  81. package/dist/cli-bundle/sdk-graph.js +1 -1
  82. package/dist/cli-bundle/sdk-merge.js +57 -57
  83. package/dist/cli-bundle/sdk-query.js +1 -1
  84. package/dist/cli-bundle/sdk-runtime.js +1 -1
  85. package/dist/cli-bundle/sdk-testing.js +1 -1
  86. package/dist/cli-bundle/sdk.js +11 -11
  87. package/dist/core/extensions/extension-hook-runtime.js +1 -1
  88. package/dist/core/extensions/extension-types.d.ts +30 -0
  89. package/dist/core/extensions/extension-types.js +1 -1
  90. package/dist/core/extensions/index.d.ts +21 -1
  91. package/dist/core/extensions/index.js +1 -1
  92. package/dist/core/extensions/mutation-actor-snapshot.js +2 -0
  93. package/dist/core/extensions/mutation-actor.js +2 -0
  94. package/dist/core/item/deferred-fields.js +2 -0
  95. package/dist/core/item/item-format-version.d.ts +8 -7
  96. package/dist/core/item/item-format-version.js +1 -1
  97. package/dist/core/item/item-format.js +2 -2
  98. package/dist/core/output/output.d.ts +7 -0
  99. package/dist/core/output/output.js +3 -3
  100. package/dist/core/schema/runtime-field-values.d.ts +4 -0
  101. package/dist/core/schema/runtime-field-values.js +1 -1
  102. package/dist/core/shared/item-metadata-contract.js +1 -1
  103. package/dist/core/store/item-store.js +1 -1
  104. package/dist/sdk/agent/closed-domain-contracts.js +1 -1
  105. package/dist/sdk/authoring.d.ts +1 -1
  106. package/dist/sdk/authoring.js +1 -1
  107. package/dist/sdk/cli-contracts/commander-mutation-options.js +1 -1
  108. package/dist/sdk/cli-contracts/flag-contracts.js +1 -1
  109. package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +1 -1
  110. package/dist/sdk/cli-contracts/registration-helpers.js +1 -1
  111. package/dist/sdk/cli-contracts/runtime-contracts.d.ts +1 -1
  112. package/dist/sdk/cli-contracts/runtime-contracts.js +1 -1
  113. package/dist/sdk/cli-contracts/tool-option-contracts.d.ts +1 -1
  114. package/dist/sdk/cli-contracts/tool-option-contracts.js +1 -1
  115. package/dist/sdk/cli-contracts/tool-parameter-tables.js +1 -1
  116. package/dist/sdk/cli-contracts/tool-schema.d.ts +1 -1
  117. package/dist/sdk/cli-contracts/tool-schema.js +1 -1
  118. package/dist/sdk/completion/fish.js +3 -1
  119. package/dist/sdk/completion/zsh.js +3 -1
  120. package/dist/sdk/extension/command-options.d.ts +23 -4
  121. package/dist/sdk/extension/command-options.js +1 -1
  122. package/dist/sdk/extension/native-command-options.js +2 -0
  123. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -1
  124. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1 -1
  125. package/dist/sdk/governance/health.js +1 -1
  126. package/dist/sdk/governance/lifecycle-dependency-cycles.d.ts +12 -0
  127. package/dist/sdk/governance/lifecycle-dependency-cycles.js +2 -0
  128. package/dist/sdk/governance/validate-deferred-fields.js +2 -0
  129. package/dist/sdk/governance/validate.d.ts +2 -2
  130. package/dist/sdk/governance/validate.js +1 -1
  131. package/dist/sdk/index.d.ts +1 -1
  132. package/dist/sdk/index.js +1 -1
  133. package/dist/sdk/item-transaction.d.ts +2 -2
  134. package/dist/sdk/item-transaction.js +1 -1
  135. package/dist/sdk/lifecycle/close.js +1 -1
  136. package/dist/sdk/lifecycle/copy.js +1 -1
  137. package/dist/sdk/lifecycle/create-deferrals.js +2 -0
  138. package/dist/sdk/lifecycle/create.d.ts +6 -2
  139. package/dist/sdk/lifecycle/create.js +1 -1
  140. package/dist/sdk/lifecycle/restore.js +1 -1
  141. package/dist/sdk/lifecycle/shared-unset-fields.d.ts +7 -1
  142. package/dist/sdk/lifecycle/shared-unset-fields.js +1 -1
  143. package/dist/sdk/merge/three-way.d.ts +1 -1
  144. package/dist/sdk/merge/three-way.js +2 -2
  145. package/dist/sdk/package-import-adapters.d.ts +9 -1
  146. package/dist/sdk/package-import-adapters.js +1 -1
  147. package/dist/sdk/public-surface.json +1 -1
  148. package/dist/sdk/query/complete-list.d.ts +14 -5
  149. package/dist/sdk/query/complete-list.js +1 -1
  150. package/dist/sdk/query/list.js +1 -1
  151. package/dist/sdk/query/projection-contracts.d.ts +6 -0
  152. package/dist/sdk/query/projection-contracts.js +1 -1
  153. package/dist/sdk/read-output/extension.js +1 -1
  154. package/dist/sdk/runtime-input.d.ts +6 -2
  155. package/dist/sdk/runtime-input.js +1 -1
  156. package/dist/sdk/runtime-primitives.d.ts +1 -1
  157. package/dist/sdk/runtime-primitives.js +1 -1
  158. package/dist/sdk/runtime.d.ts +2 -2
  159. package/dist/sdk/runtime.js +1 -1
  160. package/dist/sdk/structured-mutations.js +1 -1
  161. package/dist/sdk/testing.d.ts +15 -2
  162. package/dist/sdk/testing.js +1 -1
  163. package/dist/types.d.ts +8 -0
  164. package/dist/types.js +1 -1
  165. package/docs/COMMANDS.md +9 -0
  166. package/docs/EXTENSIONS.md +1 -1
  167. package/docs/SDK.md +111 -5
  168. package/docs/generated/FLAG_LEXICON_BUDGETS.md +1 -1
  169. package/marketplace.json +1 -1
  170. package/package.json +6 -3
  171. package/packages/pm-beads/package.json +1 -1
  172. package/packages/pm-calendar/extensions/calendar/command-definitions.ts +2 -0
  173. package/packages/pm-calendar/package.json +1 -1
  174. package/packages/pm-command-kit/package.json +1 -1
  175. package/packages/pm-digital-twin/package.json +1 -1
  176. package/packages/pm-governance-audit/package.json +1 -1
  177. package/packages/pm-guide-shell/package.json +1 -1
  178. package/packages/pm-kanban/package.json +1 -1
  179. package/packages/pm-lifecycle-hooks/package.json +1 -1
  180. package/packages/pm-linked-test-adapters/package.json +1 -1
  181. package/packages/pm-search-advanced/package.json +1 -1
  182. package/packages/pm-templates/package.json +1 -1
  183. package/packages/pm-todos/extensions/todos/runtime.ts +3 -0
  184. package/packages/pm-todos/package.json +1 -1
  185. package/packages/pm-vcs/package.json +1 -1
  186. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  187. package/plugins/pm-claude/package.json +1 -1
  188. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  189. package/plugins/pm-codex/package.json +1 -1
  190. package/plugins/pm-codex/plugin.json +1 -1
  191. package/runtime-dependencies.json +1 -1
  192. package/dist/cli-bundle/chunks/chunk-25BUKX4W.js +0 -2
  193. package/dist/cli-bundle/chunks/chunk-27FG6ROB.js +0 -2
  194. package/dist/cli-bundle/chunks/chunk-5TGFB34A.js +0 -2
  195. package/dist/cli-bundle/chunks/chunk-BHH65KLL.js +0 -2
  196. package/dist/cli-bundle/chunks/chunk-C7M54YV6.js +0 -122
  197. package/dist/cli-bundle/chunks/chunk-DMWL3K4A.js +0 -20
  198. package/dist/cli-bundle/chunks/chunk-DVN7CD5B.js +0 -2
  199. package/dist/cli-bundle/chunks/chunk-DZ7CWUVM.js +0 -8
  200. package/dist/cli-bundle/chunks/chunk-FRCNYOTG.js +0 -9
  201. package/dist/cli-bundle/chunks/chunk-HXECILIE.js +0 -31
  202. package/dist/cli-bundle/chunks/chunk-IDFRGH4X.js +0 -3
  203. package/dist/cli-bundle/chunks/chunk-JSTBYDLL.js +0 -3
  204. package/dist/cli-bundle/chunks/chunk-O4ZLEN4T.js +0 -3
  205. package/dist/cli-bundle/chunks/chunk-OTM6PXZQ.js +0 -8
  206. package/dist/cli-bundle/chunks/chunk-PC5DGK3C.js +0 -6
  207. package/dist/cli-bundle/chunks/chunk-PF3V443A.js +0 -2
  208. package/dist/cli-bundle/chunks/chunk-U2HVJVA5.js +0 -2
  209. package/dist/cli-bundle/chunks/chunk-VERRDW3Q.js +0 -2
  210. package/dist/cli-bundle/chunks/item-revision-VGIHIWZM.js +0 -2
  211. package/dist/cli-bundle/chunks/item-transaction-6OB6BGTD.js +0 -2
  212. package/dist/cli-bundle/chunks/mutation-admission-LL6SGQYU.js +0 -2
  213. package/dist/cli-bundle/chunks/register-operations-6RQF6IAE.js +0 -2
  214. package/dist/cli-bundle/chunks/register-setup-XGPOFFD3.js +0 -2
  215. package/dist/cli-bundle/chunks/stage-ZS7WNUD4.js +0 -2
  216. package/dist/cli-bundle/focused-chunks/chunk-2A4JCFMI.js +0 -2
  217. package/dist/cli-bundle/focused-chunks/chunk-2T6MQ7NP.js +0 -3
  218. package/dist/cli-bundle/focused-chunks/chunk-32QYILXW.js +0 -82
  219. package/dist/cli-bundle/focused-chunks/chunk-4WOF3Q6R.js +0 -2
  220. package/dist/cli-bundle/focused-chunks/chunk-5IQPFV4Y.js +0 -2
  221. package/dist/cli-bundle/focused-chunks/chunk-6C7NBJ7A.js +0 -26
  222. package/dist/cli-bundle/focused-chunks/chunk-FNLOLNPQ.js +0 -2
  223. package/dist/cli-bundle/focused-chunks/chunk-G6ERMFJ5.js +0 -3
  224. package/dist/cli-bundle/focused-chunks/chunk-HRLGC3P7.js +0 -28
  225. package/dist/cli-bundle/focused-chunks/chunk-JHC3X43E.js +0 -2
  226. package/dist/cli-bundle/focused-chunks/chunk-MKYNDWT3.js +0 -91
  227. package/dist/cli-bundle/focused-chunks/chunk-RDTHL44U.js +0 -2
  228. package/dist/cli-bundle/focused-chunks/chunk-UCCLV5GJ.js +0 -8
  229. package/dist/cli-bundle/focused-chunks/chunk-W3RWCLEU.js +0 -2
  230. package/dist/cli-bundle/focused-chunks/chunk-W57DSFSU.js +0 -44
  231. package/dist/cli-bundle/focused-chunks/item-revision-7J7WSCPC.js +0 -2
  232. package/dist/cli-bundle/focused-chunks/item-transaction-F5YMCPRB.js +0 -2
  233. package/dist/cli-bundle/focused-chunks/mutation-admission-2NRQEAOG.js +0 -2
  234. package/dist/cli-bundle/focused-chunks/stage-2KVCKOGC.js +0 -2
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Defines public SDK APIs and package-author helpers for Testing.
5
5
  */
6
- import type{AfterCommandHookContext,BeforeCommandHookContext,BeforeMutationHookContext,CommandHandlerResult,CommandOverrideContext,CommandOverrideResult,ExtensionActivationResult,ExtensionCapability,ExtensionCommandRegistry,ExtensionDeactivationResult,ExtensionGovernancePolicy,ExtensionHookRegistry,ExtensionCommandSdk,ExtensionLayer,ExtensionManifest,ExtensionParserRegistry,ExtensionPreflightRegistry,ExtensionRegistrationRegistry,ExtensionRendererRegistry,ExtensionServiceName,ExtensionServiceRegistry,FlagDefinition,OnIndexHookContext,OnReadHookContext,OnWriteHookContext,OutputRendererFormat,ParserOverrideContext,ParserOverrideResult,PreflightOverrideContext,PreflightOverrideResult,RegisteredExtensionCommandDefinition,RegisteredExtensionCommandOverride,RegisteredExtensionExporter,RegisteredExtensionFlagDefinitions,RegisteredExtensionImporter,RegisteredExtensionParserOverride,RegisteredExtensionPreflightOverride,RegisteredExtensionProjectProfile,RegisteredExtensionRendererOverride,RegisteredExtensionSchemaFieldDefinitions,RegisteredExtensionSchemaItemTypeDefinitions,RegisteredExtensionSchemaMigrationDefinition,RegisteredExtensionSearchProvider,RegisteredExtensionServiceOverride,RegisteredExtensionVectorStoreAdapter,RendererOverrideContext,RendererOverrideResult,SchemaFieldDefinition,SchemaItemTypeDefinition,SearchProviderEmbedBatchContext,SearchProviderEmbedContext,SearchProviderQueryContext,SearchProviderQueryExpansionContext,SearchProviderQueryExpansionResult,SearchProviderQueryResult,SearchProviderRerankContext,SearchProviderRerankResult,ServiceOverrideContext,ServiceOverrideResult,VectorStoreDeleteContext,VectorStoreQueryContext,VectorStoreQueryHit,VectorStoreUpsertContext}from "../core/extensions/loader.js";import{describeExtensionBlueprint,lintExtensionBlueprint}from "./compose.js";import{describeExtensionActivation}from "../core/extensions/activation-summary.js";import type{DescribeExtensionActivationOptions,ExtensionActivationSummary}from "../core/extensions/activation-summary.js";import type{ProjectProfileDefinition}from "../core/profile/profile-presets.js";import{type ProjectProfileLintReport}from "../core/profile/profile-lint.js";import{renderExtensionSurfaceMarkdown}from "../core/extensions/activation-summary-markdown.js";import type{ExtensionSurfaceMarkdownOptions}from "../core/extensions/activation-summary-markdown.js";import type{ExtensionBlueprint,ExtensionBlueprintLintCode,ExtensionBlueprintLintFinding,ExtensionBlueprintLintResult,ExtensionBlueprintLintSeverity,ExtensionManifestCompatibilityManifest,ExtensionManifestCompatibilityResult,ExtensionManifestCompatibilityTarget,ExtensionPreflightReport,LintExtensionBlueprintOptions,PreflightExtensionOptions}from "./compose.js";import type{GlobalOptions}from "../core/shared/command-types.js";import type{PmPackageManifest,PmPackageResourceKind}from "../core/packages/manifest.js";
6
+ import type{AfterCommandHookContext,BeforeCommandHookContext,BeforeMutationHookContext,MutationActor,CommandHandlerResult,CommandOverrideContext,CommandOverrideResult,ExtensionActivationResult,ExtensionCapability,ExtensionCommandRegistry,ExtensionDeactivationResult,ExtensionGovernancePolicy,ExtensionHookRegistry,ExtensionCommandSdk,ExtensionLayer,ExtensionManifest,ExtensionParserRegistry,ExtensionPreflightRegistry,ExtensionRegistrationRegistry,ExtensionRendererRegistry,ExtensionServiceName,ExtensionServiceRegistry,FlagDefinition,OnIndexHookContext,OnReadHookContext,OnWriteHookContext,OutputRendererFormat,ParserOverrideContext,ParserOverrideResult,PreflightOverrideContext,PreflightOverrideResult,RegisteredExtensionCommandDefinition,RegisteredExtensionCommandOverride,RegisteredExtensionExporter,RegisteredExtensionFlagDefinitions,RegisteredExtensionImporter,RegisteredExtensionParserOverride,RegisteredExtensionPreflightOverride,RegisteredExtensionProjectProfile,RegisteredExtensionRendererOverride,RegisteredExtensionSchemaFieldDefinitions,RegisteredExtensionSchemaItemTypeDefinitions,RegisteredExtensionSchemaMigrationDefinition,RegisteredExtensionSearchProvider,RegisteredExtensionServiceOverride,RegisteredExtensionVectorStoreAdapter,RendererOverrideContext,RendererOverrideResult,SchemaFieldDefinition,SchemaItemTypeDefinition,SearchProviderEmbedBatchContext,SearchProviderEmbedContext,SearchProviderQueryContext,SearchProviderQueryExpansionContext,SearchProviderQueryExpansionResult,SearchProviderQueryResult,SearchProviderRerankContext,SearchProviderRerankResult,ServiceOverrideContext,ServiceOverrideResult,VectorStoreDeleteContext,VectorStoreQueryContext,VectorStoreQueryHit,VectorStoreUpsertContext}from "../core/extensions/loader.js";import{describeExtensionBlueprint,lintExtensionBlueprint}from "./compose.js";import{describeExtensionActivation}from "../core/extensions/activation-summary.js";import type{DescribeExtensionActivationOptions,ExtensionActivationSummary}from "../core/extensions/activation-summary.js";import type{ProjectProfileDefinition}from "../core/profile/profile-presets.js";import{type ProjectProfileLintReport}from "../core/profile/profile-lint.js";import{renderExtensionSurfaceMarkdown}from "../core/extensions/activation-summary-markdown.js";import type{ExtensionSurfaceMarkdownOptions}from "../core/extensions/activation-summary-markdown.js";import type{ExtensionBlueprint,ExtensionBlueprintLintCode,ExtensionBlueprintLintFinding,ExtensionBlueprintLintResult,ExtensionBlueprintLintSeverity,ExtensionManifestCompatibilityManifest,ExtensionManifestCompatibilityResult,ExtensionManifestCompatibilityTarget,ExtensionPreflightReport,LintExtensionBlueprintOptions,PreflightExtensionOptions}from "./compose.js";import type{GlobalOptions}from "../core/shared/command-types.js";import type{PmPackageManifest,PmPackageResourceKind}from "../core/packages/manifest.js";
7
7
  /** Host-pinned TOON codecs for semantic package-output assertions without deep imports. */
8
8
  export{decode as decodeToon,encode as encodeToon}from "@toon-format/toon";
9
9
  /** Codec options and JSON values owned by the exact implementation used by the host. */
@@ -49,10 +49,23 @@ sdk?:ExtensionCommandSdk;
49
49
  sdkFactory?:(context:{
50
50
  /** Tracker storage root for tracker data under `.agents/pm`, not the workspace root. */
51
51
  pmRoot:string;global:GlobalOptions;})=> ExtensionCommandSdk;}
52
+ /**
53
+ * Synthetic guard context for package tests. `actor` and `dry_run` are
54
+ * optional so tests written before GH-1719 keep compiling: an omitted actor is
55
+ * resolved from `author` exactly as a host resolves it (an omitted author is
56
+ * the unattributed `unknown` actor), and an omitted `dry_run` is `false`.
57
+ */
58
+ export type MutationGuardTestContext=Omit<BeforeMutationHookContext,"actor"|"dry_run">&{
59
+ /** Actor the guard should see; overrides `author`. */
60
+ actor?:MutationActor;
61
+ /** Author to resolve the actor from when `actor` is omitted. */
62
+ author?:string;
63
+ /** Whether the guard is evaluated for a preview that persists nothing. */
64
+ dry_run?:boolean;};
52
65
  /** Options for invoking a registered transactional mutation guard in package tests. */
53
66
  export interface RunRegisteredMutationGuardForTestOptions{
54
67
  /** Synthetic proposed mutation context, including a host-bound read-only SDK. */
55
- context:BeforeMutationHookContext;}
68
+ context:MutationGuardTestContext;}
56
69
  /**
57
70
  * Options for {@link runRegisteredHookForTest} — the lifecycle `kind` to fire and
58
71
  * the synthetic context handed to every registered hook of that kind.
@@ -1,4 +1,4 @@
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]="65a4dbbe-c9a7-5092-a325-3ba73c0fc026")}catch{}})();import{activateExtensions,deactivateExtensions,runAfterCommandHooks,runBeforeCommandHooks,runBeforeMutationHooks,runCommandHandler,runCommandOverride,runOnIndexHooks,runOnReadHooks,runOnWriteHooks,runParserOverride,runPreflightOverride,runRendererOverride,runServiceOverride}from"../core/extensions/loader.js";import{createDefaultExtensionGovernancePolicy}from"../core/extensions/extension-types.js";import{getMigrationRuntimeDefinition,resolveRegisteredSearchProvider,resolveRegisteredVectorStoreAdapter}from"../core/extensions/runtime-registrations.js";import{collectUsedExtensionCapabilities}from"../core/extensions/capability-usage.js";import{normalizeKnownExtensionCapability}from"../core/extensions/extension-capability-aliases.js";import{checkExtensionManifestCompatibility,describeExtensionBlueprint,lintExtensionBlueprint,preflightExtension}from"./compose.js";import{describeExtensionActivation}from"../core/extensions/activation-summary.js";import{lintProjectProfile}from"../core/profile/profile-lint.js";import{renderExtensionSurfaceMarkdown}from"../core/extensions/activation-summary-markdown.js";import{asPropertyRecord,resolveActivatablePropertyRecord}from"../core/shared/primitives.js";import{createExtensionCommandSdk}from"./extension-command-context.js";import{collectExtensionFlagDefinitionsForCommand,normalizeDirectExtensionCommandOptions}from"./extension/command-options.js";import{PmClient}from"./runtime.js";import{decode,encode}from"@toon-format/toon";const ACTIVATED_COMMAND_FLAG_REGISTRATIONS=Symbol.for("pm.sdk.testing.activatedFlagRegistrations");function readActivatedFlagRegistrations(commands){return commands[ACTIVATED_COMMAND_FLAG_REGISTRATIONS]}function registeredExpectationName(expectation,legacyValue){return expectation.name??legacyValue??""}const HOOK_KIND_TO_REGISTRY_FIELD={before_command:"beforeCommand",before_mutation:"beforeMutation",after_command:"afterCommand",on_read:"onRead",on_write:"onWrite",on_index:"onIndex"},RUNNABLE_HOOK_KIND_TO_REGISTRY_FIELD={before_command:"beforeCommand",after_command:"afterCommand",on_read:"onRead",on_write:"onWrite",on_index:"onIndex"};function normalizeSdkIdentifier(value){return value.trim().toLowerCase()}function normalizeSdkProfileMatchKey(value){return normalizeSdkIdentifier(value).replaceAll("-","_")}function extensionNameSuffix(extensionName){return extensionName?` from extension "${extensionName}"`:""}function sortedUnique(values){return[...new Set(values)].sort((left,right)=>left.localeCompare(right))}function normalizeSdkCommandName(command){if(typeof command!="string")throw new Error('A command name string is required. Pass it via the options object, e.g. runRegisteredCommandForTest(activation, { command: "my command" }) \u2014 positional command arguments are not supported.');return command.trim().toLowerCase().split(/\s+/).filter(part=>part.length>0).join(" ")}function formatAvailable(values){return values.length>0?values.join(", "):"(none)"}function assertStringSetIncludes(actual,expected,label){const actualValues=new Set(actual??[]),missing=sortedUnique(expected.filter(value=>!actualValues.has(value)));if(missing.length>0)throw new Error(`Expected package manifest ${label} to include ${missing.join(", ")}; available: ${formatAvailable(sortedUnique(actual??[]))}`)}function collectFlagLabels(flags){const labels=new Set;for(const flag of flags)typeof flag.long=="string"&&flag.long.trim().length>0&&labels.add(flag.long.trim()),typeof flag.short=="string"&&flag.short.trim().length>0&&labels.add(flag.short.trim());return labels}function readTestExtensionManifest(module){const moduleRecord=asPropertyRecord(module);if(!moduleRecord)return{};const manifest=asPropertyRecord(moduleRecord.manifest);if(manifest)return manifest;const defaultExport=asPropertyRecord(moduleRecord.default);return asPropertyRecord(defaultExport?.manifest)||(defaultExport&&typeof moduleRecord.default!="function"&&("name"in defaultExport||"capabilities"in defaultExport)?defaultExport:typeof module!="function"&&("name"in moduleRecord||"capabilities"in moduleRecord)?moduleRecord:{})}function resolveTestExtensionName(manifest,explicitName){return explicitName??(typeof manifest.name=="string"&&manifest.name.trim().length>0?manifest.name.trim():"test-extension")}function readTestExtensionCapabilities(manifest,options){return Array.isArray(options.capabilities)?[...options.capabilities]:Array.isArray(manifest.capabilities)?manifest.capabilities.filter(capability=>typeof capability=="string"):[]}function buildSingleExtensionLoadResult(module,manifest,identity){return{disabled_by_flag:!1,roots:{global:"",project:""},configured_enabled:[],configured_disabled:[],discovered:[],effective:[],warnings:[],policy:identity.policy,failed:[],loaded:[{layer:identity.layer,directory:"",manifest_path:"",name:identity.name,version:typeof manifest.version=="string"?manifest.version:"0.0.0",entry:typeof manifest.entry=="string"?manifest.entry:"./index.js",priority:typeof manifest.priority=="number"?manifest.priority:0,entry_path:"",capabilities:identity.capabilities,manifest_version:typeof manifest.manifest_version=="number"?manifest.manifest_version:void 0,pm_min_version:typeof manifest.pm_min_version=="string"?manifest.pm_min_version:void 0,pm_max_version:typeof manifest.pm_max_version=="string"?manifest.pm_max_version:void 0,engines:manifest.engines,trusted:manifest.trusted,provenance:manifest.provenance,sandbox_profile:manifest.sandbox_profile,permissions:manifest.permissions,activation:manifest.activation,module}]}}async function activateExtensionForTest(module,options={}){const manifest=readTestExtensionManifest(module),activation=await activateExtensions(buildSingleExtensionLoadResult(module,manifest,{name:resolveTestExtensionName(manifest,options.name),layer:options.layer??"project",capabilities:readTestExtensionCapabilities(manifest,options),policy:options.policy??createDefaultExtensionGovernancePolicy()}));return Object.defineProperty(activation.commands,ACTIVATED_COMMAND_FLAG_REGISTRATIONS,{value:activation.registrations,enumerable:!1}),activation}async function deactivateExtensionForTest(module,options={}){const manifest=readTestExtensionManifest(module);return deactivateExtensions(buildSingleExtensionLoadResult(module,manifest,{name:resolveTestExtensionName(manifest,options.name),layer:options.layer??"project",capabilities:readTestExtensionCapabilities(manifest,{}),policy:createDefaultExtensionGovernancePolicy()}),options.activation,options.deactivateTimeoutMs===void 0?{}:{deactivate_timeout_ms:options.deactivateTimeoutMs})}async function runRegisteredCommandForTest(commands,options){const command=normalizeSdkCommandName(options.command);if(command.length===0)throw new Error("Expected command name must be a non-empty string");if(!commands.handlers.some(entry=>entry.command===command)){const available=sortedUnique(commands.handlers.map(entry=>entry.command));throw new Error(`Expected a registered command handler for "${command}" to invoke. Available command handlers: ${formatAvailable(available)}`)}if(options.sdk!==void 0&&options.sdkFactory!==void 0)throw new TypeError("runRegisteredCommandForTest accepts sdk or sdkFactory, not both");const pmRoot=options.pmRoot??"",global2={json:!0,quiet:!0,noPager:!0,...options.global},sdk=options.sdk??options.sdkFactory?.({pmRoot,global:global2})??(pmRoot.length>0?createExtensionCommandSdk(pmRoot,new PmClient({pmRoot}),void 0,command):void 0),registrations=readActivatedFlagRegistrations(commands),handlerOptions=options.options?{...options.options}:{};return runCommandHandler(commands,{command,args:options.args?[...options.args]:[],options:registrations===void 0?handlerOptions:normalizeDirectExtensionCommandOptions(handlerOptions,collectExtensionFlagDefinitionsForCommand(registrations,command),command),global:global2,pm_root:pmRoot,...sdk===void 0?{}:{sdk}})}async function runRegisteredMutationGuardForTest(hooks,options){if((hooks.beforeMutation?.length??0)===0)throw new Error("Expected a registered before_mutation hook to invoke");await runBeforeMutationHooks(hooks,options.context)}async function runRegisteredHookForTest(hooks,options){const kind=options.kind;if(kind==="before_mutation")throw new Error("Invoke before_mutation hooks with runRegisteredMutationGuardForTest so denials and failures retain fail-closed semantics.");if((hooks[RUNNABLE_HOOK_KIND_TO_REGISTRY_FIELD[kind]]?.length??0)===0){const populatedKinds=sortedUnique(Object.keys(RUNNABLE_HOOK_KIND_TO_REGISTRY_FIELD).filter(candidateKind=>(hooks[RUNNABLE_HOOK_KIND_TO_REGISTRY_FIELD[candidateKind]]?.length??0)>0));throw new Error(`Expected a registered "${kind}" hook to invoke. Hook kinds with registrations: ${formatAvailable(populatedKinds)}`)}switch(options.kind){case"before_command":return runBeforeCommandHooks(hooks,options.context);case"after_command":return runAfterCommandHooks(hooks,options.context);case"on_read":return runOnReadHooks(hooks,options.context);case"on_write":return runOnWriteHooks(hooks,options.context);case"on_index":return runOnIndexHooks(hooks,options.context)}}async function runRegisteredParserOverrideForTest(parsers,context){const command=normalizeSdkCommandName(context.command);if(!parsers.overrides.some(entry=>entry.command===command))throw new Error(`Expected a registered parser override for command "${command}" to invoke. Available parser override commands: ${formatAvailable(sortedUnique(parsers.overrides.map(entry=>entry.command)))}`);return runParserOverride(parsers,context)}async function runRegisteredPreflightOverrideForTest(preflight,context){if(preflight.overrides.length===0)throw new Error("Expected a registered preflight override to invoke, but none are registered.");return runPreflightOverride(preflight,context)}async function runRegisteredCommandOverrideForTest(commands,context){const command=normalizeSdkCommandName(context.command);if(!commands.overrides.some(entry=>entry.command===command))throw new Error(`Expected a registered command override for command "${command}" to invoke. Available command override commands: ${formatAvailable(sortedUnique(commands.overrides.map(entry=>entry.command)))}`);return runCommandOverride(commands,context)}async function runRegisteredRendererOverrideForTest(renderers,context){if(!renderers.overrides.some(entry=>entry.format===context.format))throw new Error(`Expected a registered renderer override for format "${context.format}" to invoke. Available renderer override formats: ${formatAvailable(sortedUnique(renderers.overrides.map(entry=>entry.format)))}`);return runRendererOverride(renderers,context)}async function runRegisteredServiceOverrideForTest(services,context){if(!services.overrides.some(entry=>entry.service===context.service))throw new Error(`Expected a registered service override for service "${context.service}" to invoke. Available service override services: ${formatAvailable(sortedUnique(services.overrides.map(entry=>entry.service)))}`);return runServiceOverride(services,context)}const SEARCH_PROVIDER_OPERATION_DEFINITION_KEYS={query:["query"],embed:["embed"],embedBatch:["embedBatch","embed_batch"],queryExpansion:["queryExpansion","query_expansion"],rerank:["rerank"]};async function runRegisteredSearchProviderForTest(registrations,options){const registration=resolveRegisteredSearchProvider(registrations,options.provider);if(!registration){const available=sortedUnique(registrations.search_providers.map(entry=>entry.definition.name));throw new Error(`Expected a registered search provider "${options.provider}" to invoke. Available search providers: ${formatAvailable(available)}`)}const runtimeDefinition=registration.runtime_definition,operationFn=SEARCH_PROVIDER_OPERATION_DEFINITION_KEYS[options.operation].map(key=>runtimeDefinition[key]).find(value=>typeof value=="function");if(typeof operationFn!="function")throw new Error(`Registered search provider "${options.provider}" does not implement the "${options.operation}" operation.`);return await operationFn(options.context)}async function runRegisteredVectorStoreAdapterForTest(registrations,options){const registration=resolveRegisteredVectorStoreAdapter(registrations,options.adapter);if(!registration){const available=sortedUnique(registrations.vector_store_adapters.map(entry=>entry.definition.name));throw new Error(`Expected a registered vector store adapter "${options.adapter}" to invoke. Available vector store adapters: ${formatAvailable(available)}`)}const operationFn=registration.runtime_definition[options.operation];if(typeof operationFn!="function")throw new Error(`Registered vector store adapter "${options.adapter}" does not implement the "${options.operation}" operation.`);return await operationFn(options.context)}async function runRegisteredMigrationForTest(registrations,options){const migration=assertRegisteredMigration(registrations,{migration:options.migration,extensionName:options.extensionName}),run=getMigrationRuntimeDefinition(migration).run;if(typeof run!="function")throw new Error(`Registered migration "${options.migration}" does not implement a run function to invoke.`);const declaredStatus=migration.definition.status,context={id:migration.definition.id,command:"migration",layer:migration.layer,extension:migration.name,pm_root:options.pmRoot??"",status:(typeof declaredStatus=="string"?declaredStatus.trim().toLowerCase():"")||"pending"};return await run(context)}async function runRegisteredImporterForTest(activation,options){const importer=assertRegisteredImporter(activation.registrations,{importer:options.importer,extensionName:options.extensionName});return runRegisteredCommandForTest(activation.commands,{command:`${importer.importer} import`,args:options.args,options:options.options,global:options.global,pmRoot:options.pmRoot})}async function runRegisteredExporterForTest(activation,options){const exporter=assertRegisteredExporter(activation.registrations,{exporter:options.exporter,extensionName:options.extensionName});return runRegisteredCommandForTest(activation.commands,{command:`${exporter.exporter} export`,args:options.args,options:options.options,global:options.global,pmRoot:options.pmRoot})}function assertExtensionDeactivated(result,expectation={}){const expectedDeactivated=expectation.deactivated??1;if(result.deactivated!==expectedDeactivated)throw new Error(`Expected ${expectedDeactivated} extension${expectedDeactivated===1?"":"s"} to deactivate cleanly, but ${result.deactivated} did.`);const expectedFailed=expectation.failed??0;if(result.failed.length!==expectedFailed){const detail=result.failed.map(failure=>`${failure.layer}:${failure.name} (${failure.error})`).join(", ");throw new Error(`Expected ${expectedFailed} teardown failure${expectedFailed===1?"":"s"}, but observed ${result.failed.length}${detail.length>0?`: ${detail}`:""}.`)}return result}function assertPackageManifest(manifest,expectation){if(expectation.packageName!==void 0&&manifest.package_name!==expectation.packageName)throw new Error(`Expected package manifest package_name to be "${expectation.packageName}"; received "${manifest.package_name??"(none)"}"`);if(expectation.aliases!==void 0&&assertStringSetIncludes(manifest.aliases,expectation.aliases,"aliases"),expectation.resources!==void 0)for(const[kind,expectedPaths]of Object.entries(expectation.resources))assertStringSetIncludes(manifest.resources[kind],expectedPaths,`pm.${kind}`);return manifest}function assertRegisteredCommandContract(registrations,expectation){const expectedCommand=normalizeSdkCommandName(registeredExpectationName(expectation,expectation.command));if(expectedCommand.length===0)throw new Error("Expected command name must be a non-empty string");const commandCandidates=registrations.commands.filter(entry=>entry.command===expectedCommand),command=expectation.extensionName?commandCandidates.find(entry=>entry.name===expectation.extensionName):commandCandidates[0];if(!command){const available=registrations.commands.map(entry=>entry.command).sort((left,right)=>left.localeCompare(right)),extensionSuffix=expectation.extensionName?` from extension "${expectation.extensionName}"`:"";throw new Error(`Expected extension command "${expectedCommand}"${extensionSuffix} to be registered. Available commands: ${formatAvailable(available)}`)}if(expectation.action!==void 0&&command.action!==expectation.action)throw new Error(`Expected extension command "${expectedCommand}" action "${expectation.action}", received "${command.action}"`);if(expectation.arguments!==void 0){const actualArguments=(command.arguments??[]).map(argument=>argument.name),missingArguments=expectation.arguments.filter(argument=>!actualArguments.includes(argument));if(missingArguments.length>0)throw new Error(`Expected extension command "${expectedCommand}" arguments ${formatAvailable(expectation.arguments)}; missing ${formatAvailable(missingArguments)}; available ${formatAvailable(actualArguments)}`)}const flags=registrations.flags.filter(entry=>entry.target_command===expectedCommand&&(expectation.extensionName===void 0||entry.name===expectation.extensionName)).flatMap(entry=>entry.flags);if(expectation.flags!==void 0){const actualFlagLabels=collectFlagLabels(flags),missingFlags=expectation.flags.filter(flag=>!actualFlagLabels.has(flag));if(missingFlags.length>0)throw new Error(`Expected extension command "${expectedCommand}" flags ${formatAvailable(expectation.flags)}; missing ${formatAvailable(missingFlags)}; available ${formatAvailable([...actualFlagLabels].sort((left,right)=>left.localeCompare(right)))}`)}return{command,flags}}function assertRegisteredFlags(registrations,expectation){const expectedCommand=normalizeSdkCommandName(registeredExpectationName(expectation,expectation.targetCommand));if(expectedCommand.length===0)throw new Error("Expected target command name must be a non-empty string");const candidates=registrations.flags.filter(entry=>entry.target_command===expectedCommand);let registration;if(expectation.extensionName)registration=candidates.find(entry=>entry.name===expectation.extensionName);else if(candidates.length===1)registration=candidates[0];else if(candidates.length>1){const availableExtensions=sortedUnique(candidates.map(entry=>entry.name));throw new Error(`Expected flags for target command "${expectedCommand}" matched multiple extensions: ${formatAvailable(availableExtensions)}. Specify extensionName to choose one registration.`)}if(!registration){const available=sortedUnique(registrations.flags.map(entry=>entry.target_command)),availableExtensions=sortedUnique(candidates.map(entry=>entry.name));throw new Error(`Expected flags for target command "${expectedCommand}"${extensionNameSuffix(expectation.extensionName)} to be registered. Available flag target commands: ${formatAvailable(available)}; matching extensions: ${formatAvailable(availableExtensions)}`)}if(expectation.flags!==void 0){const actualFlagLabels=collectFlagLabels(registration.flags),missingFlags=expectation.flags.filter(flag=>!actualFlagLabels.has(flag));if(missingFlags.length>0)throw new Error(`Expected flags for target command "${expectedCommand}" to include ${formatAvailable(expectation.flags)}; missing ${formatAvailable(missingFlags)}; available ${formatAvailable([...actualFlagLabels].sort((left,right)=>left.localeCompare(right)))}`)}return registration}function assertRegisteredHook(hooks,expectation){const field=HOOK_KIND_TO_REGISTRY_FIELD[expectation.kind],candidates=hooks[field]??[],hook=expectation.extensionName?candidates.find(entry=>entry.name===expectation.extensionName):candidates[0];if(!hook){const available=sortedUnique(candidates.map(entry=>entry.name));throw new Error(`Expected a "${expectation.kind}" hook${extensionNameSuffix(expectation.extensionName)} to be registered. Available "${expectation.kind}" hooks: ${formatAvailable(available)}`)}return hook}function assertRegisteredSearchProvider(registrations,expectation){const expectedProvider=normalizeSdkIdentifier(registeredExpectationName(expectation,expectation.provider));if(expectedProvider.length===0)throw new Error("Expected search provider name must be a non-empty string");const candidates=registrations.search_providers.filter(entry=>normalizeSdkIdentifier(entry.definition.name)===expectedProvider),provider=expectation.extensionName?candidates.find(entry=>entry.name===expectation.extensionName):candidates[0];if(!provider){const available=sortedUnique(registrations.search_providers.map(entry=>entry.definition.name));throw new Error(`Expected search provider "${expectedProvider}"${extensionNameSuffix(expectation.extensionName)} to be registered. Available search providers: ${formatAvailable(available)}`)}return provider}function assertRegisteredVectorStoreAdapter(registrations,expectation){const expectedAdapter=normalizeSdkIdentifier(registeredExpectationName(expectation,expectation.adapter));if(expectedAdapter.length===0)throw new Error("Expected vector store adapter name must be a non-empty string");const candidates=registrations.vector_store_adapters.filter(entry=>normalizeSdkIdentifier(entry.definition.name)===expectedAdapter),adapter=expectation.extensionName?candidates.find(entry=>entry.name===expectation.extensionName):candidates[0];if(!adapter){const available=sortedUnique(registrations.vector_store_adapters.map(entry=>entry.definition.name));throw new Error(`Expected vector store adapter "${expectedAdapter}"${extensionNameSuffix(expectation.extensionName)} to be registered. Available vector store adapters: ${formatAvailable(available)}`)}return adapter}function assertRegisteredImporter(registrations,expectation){const expectedImporter=normalizeSdkIdentifier(registeredExpectationName(expectation,expectation.importer));if(expectedImporter.length===0)throw new Error("Expected importer name must be a non-empty string");const candidates=registrations.importers.filter(entry=>normalizeSdkIdentifier(entry.importer)===expectedImporter),importer=expectation.extensionName?candidates.find(entry=>entry.name===expectation.extensionName):candidates[0];if(!importer){const available=sortedUnique(registrations.importers.map(entry=>entry.importer));throw new Error(`Expected importer "${expectedImporter}"${extensionNameSuffix(expectation.extensionName)} to be registered. Available importers: ${formatAvailable(available)}`)}return importer}function assertRegisteredExporter(registrations,expectation){const expectedExporter=normalizeSdkIdentifier(registeredExpectationName(expectation,expectation.exporter));if(expectedExporter.length===0)throw new Error("Expected exporter name must be a non-empty string");const candidates=registrations.exporters.filter(entry=>normalizeSdkIdentifier(entry.exporter)===expectedExporter),exporter=expectation.extensionName?candidates.find(entry=>entry.name===expectation.extensionName):candidates[0];if(!exporter){const available=sortedUnique(registrations.exporters.map(entry=>entry.exporter));throw new Error(`Expected exporter "${expectedExporter}"${extensionNameSuffix(expectation.extensionName)} to be registered. Available exporters: ${formatAvailable(available)}`)}return exporter}function assertRegisteredItemField(registrations,expectation){const expectedField=normalizeSdkIdentifier(registeredExpectationName(expectation,expectation.field));if(expectedField.length===0)throw new Error("Expected item field name must be a non-empty string");const match=registrations.item_fields.filter(entry=>expectation.extensionName===void 0||entry.name===expectation.extensionName).map(registration=>({registration,field:registration.fields.find(field=>normalizeSdkIdentifier(field.name)===expectedField)})).filter(entry=>entry.field!==void 0).find(entry=>expectation.type===void 0||entry.field.type===expectation.type);if(!match){const available=sortedUnique(registrations.item_fields.flatMap(entry=>entry.fields.map(field=>`${field.name}:${field.type}`)));throw new Error(`Expected item field "${expectedField}"${extensionNameSuffix(expectation.extensionName)} to be registered. Available item fields: ${formatAvailable(available)}`)}return match}function assertRegisteredItemType(registrations,expectation){const expectedType=normalizeSdkIdentifier(registeredExpectationName(expectation,expectation.itemType));if(expectedType.length===0)throw new Error("Expected item type name must be a non-empty string");const match=registrations.item_types.filter(entry=>expectation.extensionName===void 0||entry.name===expectation.extensionName).map(registration=>({registration,itemType:registration.types.find(itemType=>normalizeSdkIdentifier(itemType.name)===expectedType)})).filter(entry=>entry.itemType!==void 0).find(entry=>expectation.folder===void 0||entry.itemType.folder===expectation.folder);if(!match){const available=sortedUnique(registrations.item_types.flatMap(entry=>entry.types.map(itemType=>`${itemType.name}:${itemType.folder}`)));throw new Error(`Expected item type "${expectedType}"${extensionNameSuffix(expectation.extensionName)} to be registered. Available item types: ${formatAvailable(available)}`)}return match}function assertRegisteredProfile(registrations,expectation){const expectedProfile=normalizeSdkProfileMatchKey(registeredExpectationName(expectation,expectation.profile));if(expectedProfile.length===0)throw new Error("Expected profile name must be a non-empty string");const match=registrations.profiles.filter(entry=>expectation.extensionName===void 0||entry.name===expectation.extensionName).find(entry=>normalizeSdkProfileMatchKey(entry.profile.name)===expectedProfile);if(!match){const available=sortedUnique(registrations.profiles.map(entry=>entry.profile.name));throw new Error(`Expected profile "${expectedProfile}"${extensionNameSuffix(expectation.extensionName)} to be registered. Available profiles: ${formatAvailable(available)}`)}return{registration:match,profile:match.profile}}function assertRegisteredCommandOverride(commands,expectation){const expectedCommand=normalizeSdkCommandName(registeredExpectationName(expectation,expectation.command));if(expectedCommand.length===0)throw new Error("Expected command name must be a non-empty string");const candidates=commands.overrides.filter(entry=>entry.command===expectedCommand),override=expectation.extensionName?candidates.find(entry=>entry.name===expectation.extensionName):candidates[0];if(!override){const available=sortedUnique(commands.overrides.map(entry=>entry.command));throw new Error(`Expected command override "${expectedCommand}"${extensionNameSuffix(expectation.extensionName)} to be registered. Available command overrides: ${formatAvailable(available)}`)}return override}function assertRegisteredParserOverride(parsers,expectation){const expectedCommand=normalizeSdkCommandName(registeredExpectationName(expectation,expectation.command));if(expectedCommand.length===0)throw new Error("Expected command name must be a non-empty string");const candidates=parsers.overrides.filter(entry=>entry.command===expectedCommand),override=expectation.extensionName?candidates.find(entry=>entry.name===expectation.extensionName):candidates[0];if(!override){const available=sortedUnique(parsers.overrides.map(entry=>entry.command));throw new Error(`Expected parser override "${expectedCommand}"${extensionNameSuffix(expectation.extensionName)} to be registered. Available parser overrides: ${formatAvailable(available)}`)}return override}function assertRegisteredPreflightOverride(preflight,expectation={}){const override=expectation.extensionName?preflight.overrides.find(entry=>entry.name===expectation.extensionName):preflight.overrides[0];if(!override){const available=sortedUnique(preflight.overrides.map(entry=>entry.name));throw new Error(`Expected a preflight override${extensionNameSuffix(expectation.extensionName)} to be registered. Available preflight overrides: ${formatAvailable(available)}`)}return override}function assertRegisteredRendererOverride(renderers,expectation){const expectedFormat=normalizeSdkIdentifier(registeredExpectationName(expectation,expectation.format));if(expectedFormat.length===0)throw new Error("Expected renderer format must be a non-empty string");const candidates=renderers.overrides.filter(entry=>entry.format===expectedFormat),override=expectation.extensionName?candidates.find(entry=>entry.name===expectation.extensionName):candidates[0];if(!override){const available=sortedUnique(renderers.overrides.map(entry=>entry.format));throw new Error(`Expected renderer override "${expectedFormat}"${extensionNameSuffix(expectation.extensionName)} to be registered. Available renderer overrides: ${formatAvailable(available)}`)}return override}function assertRegisteredServiceOverride(services,expectation){const expectedService=normalizeSdkIdentifier(registeredExpectationName(expectation,expectation.service));if(expectedService.length===0)throw new Error("Expected service name must be a non-empty string");const candidates=services.overrides.filter(entry=>normalizeSdkIdentifier(entry.service)===expectedService),override=expectation.extensionName?candidates.find(entry=>entry.name===expectation.extensionName):candidates[0];if(!override){const available=sortedUnique(services.overrides.map(entry=>entry.service));throw new Error(`Expected service override "${expectedService}"${extensionNameSuffix(expectation.extensionName)} to be registered. Available service overrides: ${formatAvailable(available)}`)}return override}function assertRegisteredMigration(registrations,expectation){const expectedMigration=normalizeSdkIdentifier(registeredExpectationName(expectation,expectation.migration));if(expectedMigration.length===0)throw new Error("Expected migration id must be a non-empty string");const candidates=registrations.migrations.filter(entry=>(expectation.extensionName===void 0||entry.name===expectation.extensionName)&&typeof entry.definition.id=="string"&&normalizeSdkIdentifier(entry.definition.id)===expectedMigration),match=candidates.find(entry=>expectation.mandatory===void 0||(entry.definition.mandatory??!1)===expectation.mandatory);if(match)return match;const idMatch=candidates[0];if(idMatch!==void 0)throw new Error(`Expected migration "${expectedMigration}"${extensionNameSuffix(expectation.extensionName)} to have mandatory=${expectation.mandatory}, but it is mandatory=${idMatch.definition.mandatory??!1}.`);const available=sortedUnique(registrations.migrations.map(entry=>`${typeof entry.definition.id=="string"&&entry.definition.id.trim().length>0?entry.definition.id.trim():"(unnamed)"}:${entry.definition.mandatory===!0}`));throw new Error(`Expected migration "${expectedMigration}"${extensionNameSuffix(expectation.extensionName)} to be registered. Available migrations: ${formatAvailable(available)}`)}function assertExtensionCapabilityUsage(activation,expectation){const toKnownCapabilitySet=(capabilities,field)=>{const known=new Set;for(const capability of capabilities){const normalized=normalizeKnownExtensionCapability(capability);if(normalized===null)throw new Error(`Expected ${field} capability "${capability}" to be a known extension capability. Use canonical capability names (see manifest.capabilities).`);known.add(normalized)}return known},declared=[...toKnownCapabilitySet(expectation.declared,"declared")].sort((left,right)=>left.localeCompare(right)),allowUnused=toKnownCapabilitySet(expectation.allowUnused??[],"allowUnused"),used=collectUsedExtensionCapabilities(activation,{extensionName:expectation.extensionName}),usedSet=new Set(used),unused=declared.filter(capability=>!usedSet.has(capability)&&!allowUnused.has(capability));if(unused.length>0){const scopeSuffix=extensionNameSuffix(expectation.extensionName);throw new Error(`Expected every declared capability${scopeSuffix} to be exercised, but [${unused.join(", ")}] ${unused.length===1?"is":"are"} declared yet never registered against. Remove ${unused.length===1?"it":"them"} from manifest.capabilities for least privilege, or pass allowUnused for capabilities registered only behind a runtime flag.`)}return{declared,used,unused}}function assertExtensionBlueprint(blueprint,options={}){const result=lintExtensionBlueprint(blueprint,options);if(!result.ok){const errors=result.findings.filter(finding=>finding.severity==="error");throw new Error(`Extension blueprint failed preflight with ${errors.length} ${errors.length===1?"error":"errors"}:
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]="4f61bbc3-cf6d-5a5c-91df-88b8fda25be0")}catch{}})();import{activateExtensions,deactivateExtensions,runAfterCommandHooks,runBeforeCommandHooks,runBeforeMutationHooks,runCommandHandler,runCommandOverride,runOnIndexHooks,runOnReadHooks,runOnWriteHooks,runParserOverride,runPreflightOverride,runRendererOverride,runServiceOverride}from"../core/extensions/loader.js";import{createDefaultExtensionGovernancePolicy}from"../core/extensions/extension-types.js";import{getMigrationRuntimeDefinition,resolveRegisteredSearchProvider,resolveRegisteredVectorStoreAdapter}from"../core/extensions/runtime-registrations.js";import{collectUsedExtensionCapabilities}from"../core/extensions/capability-usage.js";import{normalizeKnownExtensionCapability}from"../core/extensions/extension-capability-aliases.js";import{checkExtensionManifestCompatibility,describeExtensionBlueprint,lintExtensionBlueprint,preflightExtension}from"./compose.js";import{describeExtensionActivation}from"../core/extensions/activation-summary.js";import{lintProjectProfile}from"../core/profile/profile-lint.js";import{renderExtensionSurfaceMarkdown}from"../core/extensions/activation-summary-markdown.js";import{asPropertyRecord,resolveActivatablePropertyRecord}from"../core/shared/primitives.js";import{createExtensionCommandSdk}from"./extension-command-context.js";import{collectExtensionFlagDefinitionsForCommand,normalizeDirectExtensionCommandOptions}from"./extension/command-options.js";import{resolveDirectExtensionOptionPolicy}from"./extension/native-command-options.js";import{formatOutput,projectPrintedResult}from"../core/output/output.js";import{EXIT_CODE}from"../core/shared/constants.js";import{PmCliError}from"../core/shared/errors.js";import{resolvePortableWorkspaceContext,runWithIsolatedExtensionRuntime,setActiveCommandContext,setActiveExtensionCommands,setActiveExtensionRegistrations,setActiveExtensionRenderers,setActiveExtensionServices}from"../core/extensions/index.js";import{PmClient}from"./runtime.js";import{decode,encode}from"@toon-format/toon";const ACTIVATED_COMMAND_FLAG_REGISTRATIONS=Symbol.for("pm.sdk.testing.activatedFlagRegistrations");function readActivatedFlagRegistrations(commands){return commands[ACTIVATED_COMMAND_FLAG_REGISTRATIONS]}const ACTIVATED_COMMAND_SERVICES=Symbol.for("pm.sdk.testing.activatedServices"),ACTIVATED_COMMAND_RENDERERS=Symbol.for("pm.sdk.testing.activatedRenderers");function readActivatedRenderers(commands){return commands[ACTIVATED_COMMAND_RENDERERS]}function readActivatedServices(commands){return commands[ACTIVATED_COMMAND_SERVICES]}async function admitRegisteredReadOutputResult(registrations,commands,context,outcome){if(registrations===void 0||!outcome.handled||[...registrations.commands].reverse().find(entry=>entry.command===context.command)?.read_output===void 0)return outcome;const exitCode=process.exitCode;let omittedForBudget=!1;return await runWithIsolatedExtensionRuntime(async()=>{setActiveExtensionCommands(commands),setActiveExtensionServices(readActivatedServices(commands)??null),setActiveExtensionRenderers(readActivatedRenderers(commands)??null),setActiveExtensionRegistrations(registrations),setActiveCommandContext({command:context.command,args:context.args,options:context.options,global:context.global,pm_root:context.pm_root});const global2=context.global;process.exitCode=0;try{formatOutput(projectPrintedResult(outcome.result,global2),{...global2,command:context.command,commandArgs:context.args,commandOptions:context.options,pmRoot:context.pm_root}),omittedForBudget=process.exitCode===EXIT_CODE.USAGE}finally{process.exitCode=exitCode}}),omittedForBudget&&refuseOmittedForBudget(context.command),outcome}function refuseOmittedForBudget(command){throw new PmCliError(`Read output for extension command '${command}' does not fit the requested output budget; native delivery omits the result and exits 2.`,EXIT_CODE.USAGE,{code:"output_budget_exceeded",required:"Raise outputBudget, or return fewer or smaller rows so the delivered output fits.",why:"The delivered output, including any output_format or renderer string, answers to the caller's output budget, and an infeasible budget omits the result natively.",nextSteps:["Re-run with a larger outputBudget, or without one, to inspect the full result."]})}function registeredExpectationName(expectation,legacyValue){return expectation.name??legacyValue??""}const HOOK_KIND_TO_REGISTRY_FIELD={before_command:"beforeCommand",before_mutation:"beforeMutation",after_command:"afterCommand",on_read:"onRead",on_write:"onWrite",on_index:"onIndex"},RUNNABLE_HOOK_KIND_TO_REGISTRY_FIELD={before_command:"beforeCommand",after_command:"afterCommand",on_read:"onRead",on_write:"onWrite",on_index:"onIndex"};function normalizeSdkIdentifier(value){return value.trim().toLowerCase()}function normalizeSdkProfileMatchKey(value){return normalizeSdkIdentifier(value).replaceAll("-","_")}function extensionNameSuffix(extensionName){return extensionName?` from extension "${extensionName}"`:""}function sortedUnique(values){return[...new Set(values)].sort((left,right)=>left.localeCompare(right))}function normalizeSdkCommandName(command){if(typeof command!="string")throw new Error('A command name string is required. Pass it via the options object, e.g. runRegisteredCommandForTest(activation, { command: "my command" }) \u2014 positional command arguments are not supported.');return command.trim().toLowerCase().split(/\s+/).filter(part=>part.length>0).join(" ")}function formatAvailable(values){return values.length>0?values.join(", "):"(none)"}function assertStringSetIncludes(actual,expected,label){const actualValues=new Set(actual??[]),missing=sortedUnique(expected.filter(value=>!actualValues.has(value)));if(missing.length>0)throw new Error(`Expected package manifest ${label} to include ${missing.join(", ")}; available: ${formatAvailable(sortedUnique(actual??[]))}`)}function collectFlagLabels(flags){const labels=new Set;for(const flag of flags)typeof flag.long=="string"&&flag.long.trim().length>0&&labels.add(flag.long.trim()),typeof flag.short=="string"&&flag.short.trim().length>0&&labels.add(flag.short.trim());return labels}function readTestExtensionManifest(module){const moduleRecord=asPropertyRecord(module);if(!moduleRecord)return{};const manifest=asPropertyRecord(moduleRecord.manifest);if(manifest)return manifest;const defaultExport=asPropertyRecord(moduleRecord.default);return asPropertyRecord(defaultExport?.manifest)||(defaultExport&&typeof moduleRecord.default!="function"&&("name"in defaultExport||"capabilities"in defaultExport)?defaultExport:typeof module!="function"&&("name"in moduleRecord||"capabilities"in moduleRecord)?moduleRecord:{})}function resolveTestExtensionName(manifest,explicitName){return explicitName??(typeof manifest.name=="string"&&manifest.name.trim().length>0?manifest.name.trim():"test-extension")}function readTestExtensionCapabilities(manifest,options){return Array.isArray(options.capabilities)?[...options.capabilities]:Array.isArray(manifest.capabilities)?manifest.capabilities.filter(capability=>typeof capability=="string"):[]}function buildSingleExtensionLoadResult(module,manifest,identity){return{disabled_by_flag:!1,roots:{global:"",project:""},configured_enabled:[],configured_disabled:[],discovered:[],effective:[],warnings:[],policy:identity.policy,failed:[],loaded:[{layer:identity.layer,directory:"",manifest_path:"",name:identity.name,version:typeof manifest.version=="string"?manifest.version:"0.0.0",entry:typeof manifest.entry=="string"?manifest.entry:"./index.js",priority:typeof manifest.priority=="number"?manifest.priority:0,entry_path:"",capabilities:identity.capabilities,manifest_version:typeof manifest.manifest_version=="number"?manifest.manifest_version:void 0,pm_min_version:typeof manifest.pm_min_version=="string"?manifest.pm_min_version:void 0,pm_max_version:typeof manifest.pm_max_version=="string"?manifest.pm_max_version:void 0,engines:manifest.engines,trusted:manifest.trusted,provenance:manifest.provenance,sandbox_profile:manifest.sandbox_profile,permissions:manifest.permissions,activation:manifest.activation,module}]}}async function activateExtensionForTest(module,options={}){const manifest=readTestExtensionManifest(module),activation=await activateExtensions(buildSingleExtensionLoadResult(module,manifest,{name:resolveTestExtensionName(manifest,options.name),layer:options.layer??"project",capabilities:readTestExtensionCapabilities(manifest,options),policy:options.policy??createDefaultExtensionGovernancePolicy()}));return Object.defineProperty(activation.commands,ACTIVATED_COMMAND_FLAG_REGISTRATIONS,{value:activation.registrations,enumerable:!1}),Object.defineProperty(activation.commands,ACTIVATED_COMMAND_SERVICES,{value:activation.services,enumerable:!1}),Object.defineProperty(activation.commands,ACTIVATED_COMMAND_RENDERERS,{value:activation.renderers,enumerable:!1}),activation}async function deactivateExtensionForTest(module,options={}){const manifest=readTestExtensionManifest(module);return deactivateExtensions(buildSingleExtensionLoadResult(module,manifest,{name:resolveTestExtensionName(manifest,options.name),layer:options.layer??"project",capabilities:readTestExtensionCapabilities(manifest,{}),policy:createDefaultExtensionGovernancePolicy()}),options.activation,options.deactivateTimeoutMs===void 0?{}:{deactivate_timeout_ms:options.deactivateTimeoutMs})}async function runRegisteredCommandForTest(commands,options){const command=normalizeSdkCommandName(options.command);if(command.length===0)throw new Error("Expected command name must be a non-empty string");if(!commands.handlers.some(entry=>entry.command===command)){const available=sortedUnique(commands.handlers.map(entry=>entry.command));throw new Error(`Expected a registered command handler for "${command}" to invoke. Available command handlers: ${formatAvailable(available)}`)}if(options.sdk!==void 0&&options.sdkFactory!==void 0)throw new TypeError("runRegisteredCommandForTest accepts sdk or sdkFactory, not both");const pmRoot=options.pmRoot??"",global2={json:!0,quiet:!0,noPager:!0,...options.global},sdk=options.sdk??options.sdkFactory?.({pmRoot,global:global2})??(pmRoot.length>0?createExtensionCommandSdk(pmRoot,new PmClient({pmRoot}),void 0,command):void 0),registrations=readActivatedFlagRegistrations(commands),handlerOptions=options.options?{...options.options}:{},context={command,args:options.args?[...options.args]:[],options:registrations===void 0?handlerOptions:normalizeDirectExtensionCommandOptions(handlerOptions,collectExtensionFlagDefinitionsForCommand(registrations,command),command,resolveDirectExtensionOptionPolicy(command)),global:global2,pm_root:pmRoot,...resolvePortableWorkspaceContext(pmRoot.length>0?pmRoot:void 0),...sdk===void 0?{}:{sdk}},outcome=await runCommandHandler(commands,context);return await admitRegisteredReadOutputResult(registrations,commands,context,outcome)}async function runRegisteredMutationGuardForTest(hooks,options){if((hooks.beforeMutation?.length??0)===0)throw new Error("Expected a registered before_mutation hook to invoke");const{actor,author,dry_run:dryRun,...context}=options.context,{resolveMutationActor}=await import("../core/extensions/mutation-actor.js");await runBeforeMutationHooks(hooks,{...context,actor:actor??resolveMutationActor(author??"unknown"),dry_run:dryRun===!0})}async function runRegisteredHookForTest(hooks,options){const kind=options.kind;if(kind==="before_mutation")throw new Error("Invoke before_mutation hooks with runRegisteredMutationGuardForTest so denials and failures retain fail-closed semantics.");if((hooks[RUNNABLE_HOOK_KIND_TO_REGISTRY_FIELD[kind]]?.length??0)===0){const populatedKinds=sortedUnique(Object.keys(RUNNABLE_HOOK_KIND_TO_REGISTRY_FIELD).filter(candidateKind=>(hooks[RUNNABLE_HOOK_KIND_TO_REGISTRY_FIELD[candidateKind]]?.length??0)>0));throw new Error(`Expected a registered "${kind}" hook to invoke. Hook kinds with registrations: ${formatAvailable(populatedKinds)}`)}switch(options.kind){case"before_command":return runBeforeCommandHooks(hooks,options.context);case"after_command":return runAfterCommandHooks(hooks,options.context);case"on_read":return runOnReadHooks(hooks,options.context);case"on_write":return runOnWriteHooks(hooks,options.context);case"on_index":return runOnIndexHooks(hooks,options.context)}}async function runRegisteredParserOverrideForTest(parsers,context){const command=normalizeSdkCommandName(context.command);if(!parsers.overrides.some(entry=>entry.command===command))throw new Error(`Expected a registered parser override for command "${command}" to invoke. Available parser override commands: ${formatAvailable(sortedUnique(parsers.overrides.map(entry=>entry.command)))}`);return runParserOverride(parsers,context)}async function runRegisteredPreflightOverrideForTest(preflight,context){if(preflight.overrides.length===0)throw new Error("Expected a registered preflight override to invoke, but none are registered.");return runPreflightOverride(preflight,context)}async function runRegisteredCommandOverrideForTest(commands,context){const command=normalizeSdkCommandName(context.command);if(!commands.overrides.some(entry=>entry.command===command))throw new Error(`Expected a registered command override for command "${command}" to invoke. Available command override commands: ${formatAvailable(sortedUnique(commands.overrides.map(entry=>entry.command)))}`);return runCommandOverride(commands,context)}async function runRegisteredRendererOverrideForTest(renderers,context){if(!renderers.overrides.some(entry=>entry.format===context.format))throw new Error(`Expected a registered renderer override for format "${context.format}" to invoke. Available renderer override formats: ${formatAvailable(sortedUnique(renderers.overrides.map(entry=>entry.format)))}`);return runRendererOverride(renderers,context)}async function runRegisteredServiceOverrideForTest(services,context){if(!services.overrides.some(entry=>entry.service===context.service))throw new Error(`Expected a registered service override for service "${context.service}" to invoke. Available service override services: ${formatAvailable(sortedUnique(services.overrides.map(entry=>entry.service)))}`);return runServiceOverride(services,context)}const SEARCH_PROVIDER_OPERATION_DEFINITION_KEYS={query:["query"],embed:["embed"],embedBatch:["embedBatch","embed_batch"],queryExpansion:["queryExpansion","query_expansion"],rerank:["rerank"]};async function runRegisteredSearchProviderForTest(registrations,options){const registration=resolveRegisteredSearchProvider(registrations,options.provider);if(!registration){const available=sortedUnique(registrations.search_providers.map(entry=>entry.definition.name));throw new Error(`Expected a registered search provider "${options.provider}" to invoke. Available search providers: ${formatAvailable(available)}`)}const runtimeDefinition=registration.runtime_definition,operationFn=SEARCH_PROVIDER_OPERATION_DEFINITION_KEYS[options.operation].map(key=>runtimeDefinition[key]).find(value=>typeof value=="function");if(typeof operationFn!="function")throw new Error(`Registered search provider "${options.provider}" does not implement the "${options.operation}" operation.`);return await operationFn(options.context)}async function runRegisteredVectorStoreAdapterForTest(registrations,options){const registration=resolveRegisteredVectorStoreAdapter(registrations,options.adapter);if(!registration){const available=sortedUnique(registrations.vector_store_adapters.map(entry=>entry.definition.name));throw new Error(`Expected a registered vector store adapter "${options.adapter}" to invoke. Available vector store adapters: ${formatAvailable(available)}`)}const operationFn=registration.runtime_definition[options.operation];if(typeof operationFn!="function")throw new Error(`Registered vector store adapter "${options.adapter}" does not implement the "${options.operation}" operation.`);return await operationFn(options.context)}async function runRegisteredMigrationForTest(registrations,options){const migration=assertRegisteredMigration(registrations,{migration:options.migration,extensionName:options.extensionName}),run=getMigrationRuntimeDefinition(migration).run;if(typeof run!="function")throw new Error(`Registered migration "${options.migration}" does not implement a run function to invoke.`);const declaredStatus=migration.definition.status,context={id:migration.definition.id,command:"migration",layer:migration.layer,extension:migration.name,pm_root:options.pmRoot??"",status:(typeof declaredStatus=="string"?declaredStatus.trim().toLowerCase():"")||"pending"};return await run(context)}async function runRegisteredImporterForTest(activation,options){const importer=assertRegisteredImporter(activation.registrations,{importer:options.importer,extensionName:options.extensionName});return runRegisteredCommandForTest(activation.commands,{command:`${importer.importer} import`,args:options.args,options:options.options,global:options.global,pmRoot:options.pmRoot})}async function runRegisteredExporterForTest(activation,options){const exporter=assertRegisteredExporter(activation.registrations,{exporter:options.exporter,extensionName:options.extensionName});return runRegisteredCommandForTest(activation.commands,{command:`${exporter.exporter} export`,args:options.args,options:options.options,global:options.global,pmRoot:options.pmRoot})}function assertExtensionDeactivated(result,expectation={}){const expectedDeactivated=expectation.deactivated??1;if(result.deactivated!==expectedDeactivated)throw new Error(`Expected ${expectedDeactivated} extension${expectedDeactivated===1?"":"s"} to deactivate cleanly, but ${result.deactivated} did.`);const expectedFailed=expectation.failed??0;if(result.failed.length!==expectedFailed){const detail=result.failed.map(failure=>`${failure.layer}:${failure.name} (${failure.error})`).join(", ");throw new Error(`Expected ${expectedFailed} teardown failure${expectedFailed===1?"":"s"}, but observed ${result.failed.length}${detail.length>0?`: ${detail}`:""}.`)}return result}function assertPackageManifest(manifest,expectation){if(expectation.packageName!==void 0&&manifest.package_name!==expectation.packageName)throw new Error(`Expected package manifest package_name to be "${expectation.packageName}"; received "${manifest.package_name??"(none)"}"`);if(expectation.aliases!==void 0&&assertStringSetIncludes(manifest.aliases,expectation.aliases,"aliases"),expectation.resources!==void 0)for(const[kind,expectedPaths]of Object.entries(expectation.resources))assertStringSetIncludes(manifest.resources[kind],expectedPaths,`pm.${kind}`);return manifest}function assertRegisteredCommandContract(registrations,expectation){const expectedCommand=normalizeSdkCommandName(registeredExpectationName(expectation,expectation.command));if(expectedCommand.length===0)throw new Error("Expected command name must be a non-empty string");const commandCandidates=registrations.commands.filter(entry=>entry.command===expectedCommand),command=expectation.extensionName?commandCandidates.find(entry=>entry.name===expectation.extensionName):commandCandidates[0];if(!command){const available=registrations.commands.map(entry=>entry.command).sort((left,right)=>left.localeCompare(right)),extensionSuffix=expectation.extensionName?` from extension "${expectation.extensionName}"`:"";throw new Error(`Expected extension command "${expectedCommand}"${extensionSuffix} to be registered. Available commands: ${formatAvailable(available)}`)}if(expectation.action!==void 0&&command.action!==expectation.action)throw new Error(`Expected extension command "${expectedCommand}" action "${expectation.action}", received "${command.action}"`);if(expectation.arguments!==void 0){const actualArguments=(command.arguments??[]).map(argument=>argument.name),missingArguments=expectation.arguments.filter(argument=>!actualArguments.includes(argument));if(missingArguments.length>0)throw new Error(`Expected extension command "${expectedCommand}" arguments ${formatAvailable(expectation.arguments)}; missing ${formatAvailable(missingArguments)}; available ${formatAvailable(actualArguments)}`)}const flags=registrations.flags.filter(entry=>entry.target_command===expectedCommand&&(expectation.extensionName===void 0||entry.name===expectation.extensionName)).flatMap(entry=>entry.flags);if(expectation.flags!==void 0){const actualFlagLabels=collectFlagLabels(flags),missingFlags=expectation.flags.filter(flag=>!actualFlagLabels.has(flag));if(missingFlags.length>0)throw new Error(`Expected extension command "${expectedCommand}" flags ${formatAvailable(expectation.flags)}; missing ${formatAvailable(missingFlags)}; available ${formatAvailable([...actualFlagLabels].sort((left,right)=>left.localeCompare(right)))}`)}return{command,flags}}function assertRegisteredFlags(registrations,expectation){const expectedCommand=normalizeSdkCommandName(registeredExpectationName(expectation,expectation.targetCommand));if(expectedCommand.length===0)throw new Error("Expected target command name must be a non-empty string");const candidates=registrations.flags.filter(entry=>entry.target_command===expectedCommand);let registration;if(expectation.extensionName)registration=candidates.find(entry=>entry.name===expectation.extensionName);else if(candidates.length===1)registration=candidates[0];else if(candidates.length>1){const availableExtensions=sortedUnique(candidates.map(entry=>entry.name));throw new Error(`Expected flags for target command "${expectedCommand}" matched multiple extensions: ${formatAvailable(availableExtensions)}. Specify extensionName to choose one registration.`)}if(!registration){const available=sortedUnique(registrations.flags.map(entry=>entry.target_command)),availableExtensions=sortedUnique(candidates.map(entry=>entry.name));throw new Error(`Expected flags for target command "${expectedCommand}"${extensionNameSuffix(expectation.extensionName)} to be registered. Available flag target commands: ${formatAvailable(available)}; matching extensions: ${formatAvailable(availableExtensions)}`)}if(expectation.flags!==void 0){const actualFlagLabels=collectFlagLabels(registration.flags),missingFlags=expectation.flags.filter(flag=>!actualFlagLabels.has(flag));if(missingFlags.length>0)throw new Error(`Expected flags for target command "${expectedCommand}" to include ${formatAvailable(expectation.flags)}; missing ${formatAvailable(missingFlags)}; available ${formatAvailable([...actualFlagLabels].sort((left,right)=>left.localeCompare(right)))}`)}return registration}function assertRegisteredHook(hooks,expectation){const field=HOOK_KIND_TO_REGISTRY_FIELD[expectation.kind],candidates=hooks[field]??[],hook=expectation.extensionName?candidates.find(entry=>entry.name===expectation.extensionName):candidates[0];if(!hook){const available=sortedUnique(candidates.map(entry=>entry.name));throw new Error(`Expected a "${expectation.kind}" hook${extensionNameSuffix(expectation.extensionName)} to be registered. Available "${expectation.kind}" hooks: ${formatAvailable(available)}`)}return hook}function assertRegisteredSearchProvider(registrations,expectation){const expectedProvider=normalizeSdkIdentifier(registeredExpectationName(expectation,expectation.provider));if(expectedProvider.length===0)throw new Error("Expected search provider name must be a non-empty string");const candidates=registrations.search_providers.filter(entry=>normalizeSdkIdentifier(entry.definition.name)===expectedProvider),provider=expectation.extensionName?candidates.find(entry=>entry.name===expectation.extensionName):candidates[0];if(!provider){const available=sortedUnique(registrations.search_providers.map(entry=>entry.definition.name));throw new Error(`Expected search provider "${expectedProvider}"${extensionNameSuffix(expectation.extensionName)} to be registered. Available search providers: ${formatAvailable(available)}`)}return provider}function assertRegisteredVectorStoreAdapter(registrations,expectation){const expectedAdapter=normalizeSdkIdentifier(registeredExpectationName(expectation,expectation.adapter));if(expectedAdapter.length===0)throw new Error("Expected vector store adapter name must be a non-empty string");const candidates=registrations.vector_store_adapters.filter(entry=>normalizeSdkIdentifier(entry.definition.name)===expectedAdapter),adapter=expectation.extensionName?candidates.find(entry=>entry.name===expectation.extensionName):candidates[0];if(!adapter){const available=sortedUnique(registrations.vector_store_adapters.map(entry=>entry.definition.name));throw new Error(`Expected vector store adapter "${expectedAdapter}"${extensionNameSuffix(expectation.extensionName)} to be registered. Available vector store adapters: ${formatAvailable(available)}`)}return adapter}function assertRegisteredImporter(registrations,expectation){const expectedImporter=normalizeSdkIdentifier(registeredExpectationName(expectation,expectation.importer));if(expectedImporter.length===0)throw new Error("Expected importer name must be a non-empty string");const candidates=registrations.importers.filter(entry=>normalizeSdkIdentifier(entry.importer)===expectedImporter),importer=expectation.extensionName?candidates.find(entry=>entry.name===expectation.extensionName):candidates[0];if(!importer){const available=sortedUnique(registrations.importers.map(entry=>entry.importer));throw new Error(`Expected importer "${expectedImporter}"${extensionNameSuffix(expectation.extensionName)} to be registered. Available importers: ${formatAvailable(available)}`)}return importer}function assertRegisteredExporter(registrations,expectation){const expectedExporter=normalizeSdkIdentifier(registeredExpectationName(expectation,expectation.exporter));if(expectedExporter.length===0)throw new Error("Expected exporter name must be a non-empty string");const candidates=registrations.exporters.filter(entry=>normalizeSdkIdentifier(entry.exporter)===expectedExporter),exporter=expectation.extensionName?candidates.find(entry=>entry.name===expectation.extensionName):candidates[0];if(!exporter){const available=sortedUnique(registrations.exporters.map(entry=>entry.exporter));throw new Error(`Expected exporter "${expectedExporter}"${extensionNameSuffix(expectation.extensionName)} to be registered. Available exporters: ${formatAvailable(available)}`)}return exporter}function assertRegisteredItemField(registrations,expectation){const expectedField=normalizeSdkIdentifier(registeredExpectationName(expectation,expectation.field));if(expectedField.length===0)throw new Error("Expected item field name must be a non-empty string");const match=registrations.item_fields.filter(entry=>expectation.extensionName===void 0||entry.name===expectation.extensionName).map(registration=>({registration,field:registration.fields.find(field=>normalizeSdkIdentifier(field.name)===expectedField)})).filter(entry=>entry.field!==void 0).find(entry=>expectation.type===void 0||entry.field.type===expectation.type);if(!match){const available=sortedUnique(registrations.item_fields.flatMap(entry=>entry.fields.map(field=>`${field.name}:${field.type}`)));throw new Error(`Expected item field "${expectedField}"${extensionNameSuffix(expectation.extensionName)} to be registered. Available item fields: ${formatAvailable(available)}`)}return match}function assertRegisteredItemType(registrations,expectation){const expectedType=normalizeSdkIdentifier(registeredExpectationName(expectation,expectation.itemType));if(expectedType.length===0)throw new Error("Expected item type name must be a non-empty string");const match=registrations.item_types.filter(entry=>expectation.extensionName===void 0||entry.name===expectation.extensionName).map(registration=>({registration,itemType:registration.types.find(itemType=>normalizeSdkIdentifier(itemType.name)===expectedType)})).filter(entry=>entry.itemType!==void 0).find(entry=>expectation.folder===void 0||entry.itemType.folder===expectation.folder);if(!match){const available=sortedUnique(registrations.item_types.flatMap(entry=>entry.types.map(itemType=>`${itemType.name}:${itemType.folder}`)));throw new Error(`Expected item type "${expectedType}"${extensionNameSuffix(expectation.extensionName)} to be registered. Available item types: ${formatAvailable(available)}`)}return match}function assertRegisteredProfile(registrations,expectation){const expectedProfile=normalizeSdkProfileMatchKey(registeredExpectationName(expectation,expectation.profile));if(expectedProfile.length===0)throw new Error("Expected profile name must be a non-empty string");const match=registrations.profiles.filter(entry=>expectation.extensionName===void 0||entry.name===expectation.extensionName).find(entry=>normalizeSdkProfileMatchKey(entry.profile.name)===expectedProfile);if(!match){const available=sortedUnique(registrations.profiles.map(entry=>entry.profile.name));throw new Error(`Expected profile "${expectedProfile}"${extensionNameSuffix(expectation.extensionName)} to be registered. Available profiles: ${formatAvailable(available)}`)}return{registration:match,profile:match.profile}}function assertRegisteredCommandOverride(commands,expectation){const expectedCommand=normalizeSdkCommandName(registeredExpectationName(expectation,expectation.command));if(expectedCommand.length===0)throw new Error("Expected command name must be a non-empty string");const candidates=commands.overrides.filter(entry=>entry.command===expectedCommand),override=expectation.extensionName?candidates.find(entry=>entry.name===expectation.extensionName):candidates[0];if(!override){const available=sortedUnique(commands.overrides.map(entry=>entry.command));throw new Error(`Expected command override "${expectedCommand}"${extensionNameSuffix(expectation.extensionName)} to be registered. Available command overrides: ${formatAvailable(available)}`)}return override}function assertRegisteredParserOverride(parsers,expectation){const expectedCommand=normalizeSdkCommandName(registeredExpectationName(expectation,expectation.command));if(expectedCommand.length===0)throw new Error("Expected command name must be a non-empty string");const candidates=parsers.overrides.filter(entry=>entry.command===expectedCommand),override=expectation.extensionName?candidates.find(entry=>entry.name===expectation.extensionName):candidates[0];if(!override){const available=sortedUnique(parsers.overrides.map(entry=>entry.command));throw new Error(`Expected parser override "${expectedCommand}"${extensionNameSuffix(expectation.extensionName)} to be registered. Available parser overrides: ${formatAvailable(available)}`)}return override}function assertRegisteredPreflightOverride(preflight,expectation={}){const override=expectation.extensionName?preflight.overrides.find(entry=>entry.name===expectation.extensionName):preflight.overrides[0];if(!override){const available=sortedUnique(preflight.overrides.map(entry=>entry.name));throw new Error(`Expected a preflight override${extensionNameSuffix(expectation.extensionName)} to be registered. Available preflight overrides: ${formatAvailable(available)}`)}return override}function assertRegisteredRendererOverride(renderers,expectation){const expectedFormat=normalizeSdkIdentifier(registeredExpectationName(expectation,expectation.format));if(expectedFormat.length===0)throw new Error("Expected renderer format must be a non-empty string");const candidates=renderers.overrides.filter(entry=>entry.format===expectedFormat),override=expectation.extensionName?candidates.find(entry=>entry.name===expectation.extensionName):candidates[0];if(!override){const available=sortedUnique(renderers.overrides.map(entry=>entry.format));throw new Error(`Expected renderer override "${expectedFormat}"${extensionNameSuffix(expectation.extensionName)} to be registered. Available renderer overrides: ${formatAvailable(available)}`)}return override}function assertRegisteredServiceOverride(services,expectation){const expectedService=normalizeSdkIdentifier(registeredExpectationName(expectation,expectation.service));if(expectedService.length===0)throw new Error("Expected service name must be a non-empty string");const candidates=services.overrides.filter(entry=>normalizeSdkIdentifier(entry.service)===expectedService),override=expectation.extensionName?candidates.find(entry=>entry.name===expectation.extensionName):candidates[0];if(!override){const available=sortedUnique(services.overrides.map(entry=>entry.service));throw new Error(`Expected service override "${expectedService}"${extensionNameSuffix(expectation.extensionName)} to be registered. Available service overrides: ${formatAvailable(available)}`)}return override}function assertRegisteredMigration(registrations,expectation){const expectedMigration=normalizeSdkIdentifier(registeredExpectationName(expectation,expectation.migration));if(expectedMigration.length===0)throw new Error("Expected migration id must be a non-empty string");const candidates=registrations.migrations.filter(entry=>(expectation.extensionName===void 0||entry.name===expectation.extensionName)&&typeof entry.definition.id=="string"&&normalizeSdkIdentifier(entry.definition.id)===expectedMigration),match=candidates.find(entry=>expectation.mandatory===void 0||(entry.definition.mandatory??!1)===expectation.mandatory);if(match)return match;const idMatch=candidates[0];if(idMatch!==void 0)throw new Error(`Expected migration "${expectedMigration}"${extensionNameSuffix(expectation.extensionName)} to have mandatory=${expectation.mandatory}, but it is mandatory=${idMatch.definition.mandatory??!1}.`);const available=sortedUnique(registrations.migrations.map(entry=>`${typeof entry.definition.id=="string"&&entry.definition.id.trim().length>0?entry.definition.id.trim():"(unnamed)"}:${entry.definition.mandatory===!0}`));throw new Error(`Expected migration "${expectedMigration}"${extensionNameSuffix(expectation.extensionName)} to be registered. Available migrations: ${formatAvailable(available)}`)}function assertExtensionCapabilityUsage(activation,expectation){const toKnownCapabilitySet=(capabilities,field)=>{const known=new Set;for(const capability of capabilities){const normalized=normalizeKnownExtensionCapability(capability);if(normalized===null)throw new Error(`Expected ${field} capability "${capability}" to be a known extension capability. Use canonical capability names (see manifest.capabilities).`);known.add(normalized)}return known},declared=[...toKnownCapabilitySet(expectation.declared,"declared")].sort((left,right)=>left.localeCompare(right)),allowUnused=toKnownCapabilitySet(expectation.allowUnused??[],"allowUnused"),used=collectUsedExtensionCapabilities(activation,{extensionName:expectation.extensionName}),usedSet=new Set(used),unused=declared.filter(capability=>!usedSet.has(capability)&&!allowUnused.has(capability));if(unused.length>0){const scopeSuffix=extensionNameSuffix(expectation.extensionName);throw new Error(`Expected every declared capability${scopeSuffix} to be exercised, but [${unused.join(", ")}] ${unused.length===1?"is":"are"} declared yet never registered against. Remove ${unused.length===1?"it":"them"} from manifest.capabilities for least privilege, or pass allowUnused for capabilities registered only behind a runtime flag.`)}return{declared,used,unused}}function assertExtensionBlueprint(blueprint,options={}){const result=lintExtensionBlueprint(blueprint,options);if(!result.ok){const errors=result.findings.filter(finding=>finding.severity==="error");throw new Error(`Extension blueprint failed preflight with ${errors.length} ${errors.length===1?"error":"errors"}:
2
2
  `+errors.map(finding=>` - [${finding.code}] ${finding.message}`).join(`
3
3
  `))}return result}function assertProjectProfile(profile,options={}){const report=lintProjectProfile(profile),blocking=report.findings.filter(finding=>finding.severity==="error"||options.strict===!0&&finding.severity==="warning");if(blocking.length>0)throw new Error(`Project profile "${report.profile}" failed lint with ${blocking.length} ${blocking.length===1?"issue":"issues"}:
4
4
  `+blocking.map(finding=>` - ${finding.severity} [${finding.code}] ${finding.message}`).join(`
package/dist/types.d.ts CHANGED
@@ -601,6 +601,12 @@ fail_on_skipped_triggered?:boolean;
601
601
  measurements?:TestRunMeasurement[];
602
602
  /** Commands and effective tracker contexts bound to this recorded run. */
603
603
  executions?:ItemTestRunExecution[];}
604
+ /** One strict-required create field recorded as not known yet (GH-1713). */
605
+ export interface ItemDeferredField{
606
+ /** Canonical metadata key: deadline, assignee, acceptance_criteria or estimated_minutes. */
607
+ field:string;
608
+ /** Why the value is not known yet, for example the external system it was imported from. */
609
+ reason:string;}
604
610
  /** Documents the item metadata payload exchanged by command, SDK, and package integrations. */
605
611
  export interface ItemMetadata{
606
612
  /** Stable identifier used to reference this record across commands and storage. */
@@ -649,6 +655,8 @@ author?:string;
649
655
  estimated_minutes?:number;
650
656
  /** Value that configures or reports acceptance criteria for this contract. */
651
657
  acceptance_criteria?:string;
658
+ /** Strict-required create fields recorded as not known yet, each with its reason (GH-1713). Close validation refuses the item while any listed field lacks a value. */
659
+ deferred_fields?:ItemDeferredField[];
652
660
  /** Value that configures or reports design for this contract. */
653
661
  design?:string;
654
662
  /** Value that configures or reports external ref for this contract. */
package/dist/types.js CHANGED
@@ -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]="2b5b4209-7d42-5a4f-b2a0-50c60a5d1bfe")}catch{}})();const BUILTIN_ITEM_TYPE_VALUES=["Epic","Feature","Task","Chore","Issue","Decision","Event","Reminder","Milestone","Meeting","Plan"],ITEM_TYPE_VALUES=BUILTIN_ITEM_TYPE_VALUES,STATUS_VALUES=["draft","open","in_progress","blocked","closed","canceled"],RUNTIME_STATUS_ROLE_VALUES=["draft","active","blocked","terminal","terminal_done","terminal_canceled","default_open","default_close","default_cancel"],RUNTIME_FIELD_TYPE_VALUES=["string","number","boolean","string_array","array","object"],RUNTIME_FIELD_COMMAND_VALUES=["create","update","update_many","list","search","calendar","context"],RUNTIME_UNKNOWN_FIELD_POLICY_VALUES=["allow","warn","reject"],DEPENDENCY_KIND_VALUES=["blocks","parent","child","parent_child","child_of","related","related_to","discovered_from","blocked_by","incident_from","epic","implements","recurs_from","supersedes","task","verifies"],SCOPE_VALUES=["project","global"],RISK_VALUES=["low","medium","high","critical"],ISSUE_SEVERITY_VALUES=["low","medium","high","critical"],CONFIDENCE_TEXT_VALUES=["low","medium","high"],ITEM_FORMAT_VALUES=["toon","json_markdown"],SPRINT_RELEASE_FORMAT_POLICY_VALUES=["warn","strict_error"],PARENT_REFERENCE_POLICY_VALUES=["warn","strict_error"],VALIDATE_METADATA_PROFILE_VALUES=["core","strict","custom"],GOVERNANCE_PRESET_VALUES=["minimal","default","strict","custom"],GOVERNANCE_OWNERSHIP_ENFORCEMENT_VALUES=["none","warn","strict"],GOVERNANCE_CREATE_MODE_DEFAULT_VALUES=["progressive","strict"],GOVERNANCE_CLOSE_VALIDATION_DEFAULT_VALUES=["off","warn","strict"],GOVERNANCE_WORKFLOW_ENFORCEMENT_VALUES=["off","warn","strict"],GOVERNANCE_START_BLOCKER_ENFORCEMENT_VALUES=["off","warn","strict"],GOVERNANCE_DUPLICATE_DETECTION_MODE_VALUES=["off","advisory","strict"],VALIDATE_METADATA_REQUIRED_FIELD_VALUES=["author","acceptance_criteria","estimated_minutes","close_reason","reviewer","risk","confidence","sprint","release"],RECURRENCE_FREQUENCY_VALUES=["daily","weekly","monthly","yearly"],RECURRENCE_WEEKDAY_VALUES=["mon","tue","wed","thu","fri","sat","sun"];function weekdayOrderIndex(value){return RECURRENCE_WEEKDAY_VALUES.indexOf(value)}const PLAN_MODE_VALUES=["draft","research","review","approved","executing","paused","completed","superseded"],PLAN_STEP_STATUS_VALUES=["pending","in_progress","completed","blocked","skipped","superseded"],PLAN_HARNESS_VALUES=["codex","claude-code","cursor","generic"],PLAN_STEP_LINK_KIND_VALUES=["related","blocks","blocked_by","depends_on","discovered_from","implements","recurs_from","verifies","supersedes"],CONTEXT_DEPTH_VALUES=["brief","standard","deep","full"],CONTEXT_SECTION_VALUES=["hierarchy","activity","progress","recently_created","unparented","blockers","files","workload","staleness","tests"];export{BUILTIN_ITEM_TYPE_VALUES,CONFIDENCE_TEXT_VALUES,CONTEXT_DEPTH_VALUES,CONTEXT_SECTION_VALUES,DEPENDENCY_KIND_VALUES,GOVERNANCE_CLOSE_VALIDATION_DEFAULT_VALUES,GOVERNANCE_CREATE_MODE_DEFAULT_VALUES,GOVERNANCE_DUPLICATE_DETECTION_MODE_VALUES,GOVERNANCE_OWNERSHIP_ENFORCEMENT_VALUES,GOVERNANCE_PRESET_VALUES,GOVERNANCE_START_BLOCKER_ENFORCEMENT_VALUES,GOVERNANCE_WORKFLOW_ENFORCEMENT_VALUES,ISSUE_SEVERITY_VALUES,ITEM_FORMAT_VALUES,ITEM_TYPE_VALUES,PARENT_REFERENCE_POLICY_VALUES,PLAN_HARNESS_VALUES,PLAN_MODE_VALUES,PLAN_STEP_LINK_KIND_VALUES,PLAN_STEP_STATUS_VALUES,RECURRENCE_FREQUENCY_VALUES,RECURRENCE_WEEKDAY_VALUES,RISK_VALUES,RUNTIME_FIELD_COMMAND_VALUES,RUNTIME_FIELD_TYPE_VALUES,RUNTIME_STATUS_ROLE_VALUES,RUNTIME_UNKNOWN_FIELD_POLICY_VALUES,SCOPE_VALUES,SPRINT_RELEASE_FORMAT_POLICY_VALUES,STATUS_VALUES,VALIDATE_METADATA_PROFILE_VALUES,VALIDATE_METADATA_REQUIRED_FIELD_VALUES,weekdayOrderIndex};
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]="467196ad-a2fc-5048-bc06-a1d027fb0ae2")}catch{}})();const BUILTIN_ITEM_TYPE_VALUES=["Epic","Feature","Task","Chore","Issue","Decision","Event","Reminder","Milestone","Meeting","Plan"],ITEM_TYPE_VALUES=BUILTIN_ITEM_TYPE_VALUES,STATUS_VALUES=["draft","open","in_progress","blocked","closed","canceled"],RUNTIME_STATUS_ROLE_VALUES=["draft","active","blocked","terminal","terminal_done","terminal_canceled","default_open","default_close","default_cancel"],RUNTIME_FIELD_TYPE_VALUES=["string","number","boolean","string_array","array","object"],RUNTIME_FIELD_COMMAND_VALUES=["create","update","update_many","list","search","calendar","context"],RUNTIME_UNKNOWN_FIELD_POLICY_VALUES=["allow","warn","reject"],DEPENDENCY_KIND_VALUES=["blocks","parent","child","parent_child","child_of","related","related_to","discovered_from","blocked_by","incident_from","epic","implements","recurs_from","supersedes","task","verifies"],SCOPE_VALUES=["project","global"],RISK_VALUES=["low","medium","high","critical"],ISSUE_SEVERITY_VALUES=["low","medium","high","critical"],CONFIDENCE_TEXT_VALUES=["low","medium","high"],ITEM_FORMAT_VALUES=["toon","json_markdown"],SPRINT_RELEASE_FORMAT_POLICY_VALUES=["warn","strict_error"],PARENT_REFERENCE_POLICY_VALUES=["warn","strict_error"],VALIDATE_METADATA_PROFILE_VALUES=["core","strict","custom"],GOVERNANCE_PRESET_VALUES=["minimal","default","strict","custom"],GOVERNANCE_OWNERSHIP_ENFORCEMENT_VALUES=["none","warn","strict"],GOVERNANCE_CREATE_MODE_DEFAULT_VALUES=["progressive","strict"],GOVERNANCE_CLOSE_VALIDATION_DEFAULT_VALUES=["off","warn","strict"],GOVERNANCE_WORKFLOW_ENFORCEMENT_VALUES=["off","warn","strict"],GOVERNANCE_START_BLOCKER_ENFORCEMENT_VALUES=["off","warn","strict"],GOVERNANCE_DUPLICATE_DETECTION_MODE_VALUES=["off","advisory","strict"],VALIDATE_METADATA_REQUIRED_FIELD_VALUES=["author","acceptance_criteria","estimated_minutes","close_reason","reviewer","risk","confidence","sprint","release"],RECURRENCE_FREQUENCY_VALUES=["daily","weekly","monthly","yearly"],RECURRENCE_WEEKDAY_VALUES=["mon","tue","wed","thu","fri","sat","sun"];function weekdayOrderIndex(value){return RECURRENCE_WEEKDAY_VALUES.indexOf(value)}const PLAN_MODE_VALUES=["draft","research","review","approved","executing","paused","completed","superseded"],PLAN_STEP_STATUS_VALUES=["pending","in_progress","completed","blocked","skipped","superseded"],PLAN_HARNESS_VALUES=["codex","claude-code","cursor","generic"],PLAN_STEP_LINK_KIND_VALUES=["related","blocks","blocked_by","depends_on","discovered_from","implements","recurs_from","verifies","supersedes"],CONTEXT_DEPTH_VALUES=["brief","standard","deep","full"],CONTEXT_SECTION_VALUES=["hierarchy","activity","progress","recently_created","unparented","blockers","files","workload","staleness","tests"];export{BUILTIN_ITEM_TYPE_VALUES,CONFIDENCE_TEXT_VALUES,CONTEXT_DEPTH_VALUES,CONTEXT_SECTION_VALUES,DEPENDENCY_KIND_VALUES,GOVERNANCE_CLOSE_VALIDATION_DEFAULT_VALUES,GOVERNANCE_CREATE_MODE_DEFAULT_VALUES,GOVERNANCE_DUPLICATE_DETECTION_MODE_VALUES,GOVERNANCE_OWNERSHIP_ENFORCEMENT_VALUES,GOVERNANCE_PRESET_VALUES,GOVERNANCE_START_BLOCKER_ENFORCEMENT_VALUES,GOVERNANCE_WORKFLOW_ENFORCEMENT_VALUES,ISSUE_SEVERITY_VALUES,ITEM_FORMAT_VALUES,ITEM_TYPE_VALUES,PARENT_REFERENCE_POLICY_VALUES,PLAN_HARNESS_VALUES,PLAN_MODE_VALUES,PLAN_STEP_LINK_KIND_VALUES,PLAN_STEP_STATUS_VALUES,RECURRENCE_FREQUENCY_VALUES,RECURRENCE_WEEKDAY_VALUES,RISK_VALUES,RUNTIME_FIELD_COMMAND_VALUES,RUNTIME_FIELD_TYPE_VALUES,RUNTIME_STATUS_ROLE_VALUES,RUNTIME_UNKNOWN_FIELD_POLICY_VALUES,SCOPE_VALUES,SPRINT_RELEASE_FORMAT_POLICY_VALUES,STATUS_VALUES,VALIDATE_METADATA_PROFILE_VALUES,VALIDATE_METADATA_REQUIRED_FIELD_VALUES,weekdayOrderIndex};
2
2
  //# sourceMappingURL=types.js.map
package/docs/COMMANDS.md CHANGED
@@ -576,6 +576,15 @@ pm create \
576
576
  --message "Create restore replay issue"
577
577
  ```
578
578
 
579
+ When a strict-required value is genuinely not known yet, as with a record mirrored from another tracker, defer it instead of inventing one ([pm-gh1713](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/features/pm-gh1713.toon)). `--defer <field>` (repeatable, comma lists accepted) names `deadline`, `assignee`, `acceptance-criteria`/`ac` or `estimate`, and `--defer-reason` is required with it:
580
+
581
+ ```bash
582
+ pm create "Imported issue" --type Issue --description "Mirrored from GitHub" --create-mode strict \
583
+ --defer deadline --defer assignee,ac --defer estimate --defer-reason "Imported from GitHub issue 42" ...
584
+ ```
585
+
586
+ The deferral satisfies strict create and is stored as typed `deferred_fields` metadata (item format 4), so the create history entry records it. A later write that supplies a deferred value (`pm update <id> --deadline 2026-12-31`, or a claim for `assignee`) resolves that entry in the same history entry. `pm validate --check-metadata` lists the remaining deferrals as curation work (`validate_metadata_deferred_fields:<items>`), and `pm health` reports them informationally under the integrity check's `curation` details. Close validation never lets a deferral finish work: `--validate-close strict` (the strict preset default) refuses with `close_validation_deferred_fields` and a runnable `pm update` recovery, and `warn` closes with a `close_validation_deferred_fields:<id>:<fields>` warning. Deferring a field you also set or unset in the same create is refused as `create_deferral_conflict`, and a deferral overrides a template's default for that field. SDK and MCP callers pass `defer: ["deadline", ...]` and `deferReason`.
587
+
579
588
  For long markdown bodies (multi-paragraph specs with code blocks or tables), load the body from a file with `--body-file <path>` on both `pm create` and `pm update` instead of escaping a huge inline `--body` string or issuing a second `pm append`:
580
589
 
581
590
  ```bash
@@ -317,7 +317,7 @@ Use the public SDK barrel. Do not deep-import from `src/core` or `dist/core`.
317
317
  - `api.registerRenderer("toon" | "json", renderer, ownership?)` adds format-specific renderers. Scope ownership with `commands` and/or a `resultDiscriminator`; the host checks both before invoking the renderer and falls back to native rendering for unrelated output. The legacy unscoped callback remains supported, but doctor warns because package ownership cannot be proven statically.
318
318
  - `suppressHostOutput(result?)` from `@unbrained/pm-cli/sdk` marks commands that already wrote output, preventing a second CLI payload while retaining the optional result for hooks, telemetry, and embedded hosts.
319
319
  - `api.hooks.beforeCommand(handler)`, `api.hooks.beforeMutation(handler)`, `api.hooks.afterCommand(handler)`, `api.hooks.onWrite(handler)`, `api.hooks.onRead(handler)`, and `api.hooks.onIndex(handler)` add lifecycle hooks.
320
- `beforeMutation` is a fail-closed invariant boundary inside the item lock and before item or history persistence. It receives canonical `before`/`after` snapshots, `operation`, `changed_fields`, and a host-bound read-only `sdk` with `get`/`list`. Return `{ allow: true }` (or nothing) to continue, or `{ allow: false, code, message?, remediation }` to deny with stable structured guidance. A thrown error or malformed denial blocks the write. The boundary covers create, update, close, delete, restore, annotations, and structured/bulk mutations because those surfaces share the same lifecycle primitives.
320
+ `beforeMutation` is a fail-closed invariant boundary inside the item lock and before item or history persistence. It receives canonical `before`/`after` snapshots, `operation`, `changed_fields`, and a host-bound read-only `sdk` with `get`/`list`. Return `{ allow: true }` (or nothing) to continue, or `{ allow: false, code, message?, remediation }` to deny with stable structured guidance. A thrown error or malformed denial blocks the write. The boundary covers create, update, close, delete, restore, annotations, and structured/bulk mutations because those surfaces share the same lifecycle primitives. The context also carries a read-only `actor` (GH-1719): `author` and `author_source` (`asserted`, `configured`, `detected` or `unknown`) exactly as the mutation's history entry records them, the ownership `principal` the claim check compares with an item's `claim_principal`, and the recorded `agent` provenance (`harness`, `model`, `model_source`, `instance`) when a harness was detected. The host resolves it from the mutation's own author on every surface (CLI, SDK, MCP); it is never a placeholder, so an unattributed write reports `author: "unknown"` with `author_source: "unknown"`. `dry_run` is `true` when the guard judges a preview that persists nothing: `previewItemMutations` and structured CLI previews evaluate the guards against the staged plan with the same actor the commit presents, and `pm delete --dry-run` evaluates them before reporting. Guards that read neither field keep working unchanged. See [SDK: actor-aware mutation guards](SDK.md#actor-aware-mutation-guards) for a claimant-only close policy.
321
321
  `afterCommand` receives command outcome fields plus optional compact `affected` item entries for mutations, including `previous_status`, `status`, `changed_fields`, and partial `previous`/`current` item metadata snapshots.
322
322
  `onWrite` always includes `path`, `scope`, and `op`; item mutations also add optional `item_id`, `item_type`, `before`, `after`, and `changed_fields`.
323
323
  - Registered command, importer, and exporter handlers receive `context.sdk`, a host-bound service bundle containing a native-action `PmClient`, `getItemAt`, and `openRelationshipEventStore`, alongside portable workspace coordinates. The client reuses the already-active extension schema context without recursively loading extensions, so package commands and data adapters can compose core lifecycle operations safely in CLI and SDK hosts.
package/docs/SDK.md CHANGED
@@ -2106,9 +2106,33 @@ executes the staged plan. An already committed journal instead returns
2106
2106
  without freshly executing or validating the supplied lifecycle steps. Both
2107
2107
  results disclose
2108
2108
  `unresolved_commit_constraints: ["concurrent_tracker_changes",
2109
- "extension_mutation_guards_and_hooks"]`. Newly staged validation proves core
2109
+ "extension_write_hooks", ...]`. Newly staged validation proves core
2110
2110
  semantic validity at that snapshot; commit still checks current state and runs
2111
- extension guards and hooks. Preview cost is proportional to the tracker data
2111
+ every extension hook. The caller's `beforeMutation` guards are the exception
2112
+ (GH-1719): a newly staged preview evaluates them against the staged plan with
2113
+ `dry_run: true` and the same `actor` the commit presents, so a guard denial
2114
+ surfaces at preview time. Inside a preview, the guard's `pm_root` and `sdk`
2115
+ read the disposable staged tracker. Every other hook kind stays suppressed.
2116
+
2117
+ ### Actor-aware mutation guards
2118
+
2119
+ Every `beforeMutation` context carries a frozen `actor` (GH-1719). Its
2120
+ `author`, `author_source` and `agent` provenance are exactly what the
2121
+ mutation's history entry records, and `principal` is the ownership identity the
2122
+ claim check compares. A package can therefore enforce actor-aware policy, such
2123
+ as letting only the claimant close an item:
2124
+
2125
+ ```ts
2126
+ api.hooks.beforeMutation(({ operation, before, actor }) => {
2127
+ const holder = before?.metadata.claim_principal ?? before?.metadata.assignee;
2128
+ if (operation !== "close" || !holder || holder === actor.principal) return { allow: true };
2129
+ return { allow: false, code: "close_requires_claimant", remediation: `Ask ${holder} to close it, or claim it first.` };
2130
+ });
2131
+ ```
2132
+
2133
+ Hosts never supply a placeholder: an unattributed write reports
2134
+ `author: "unknown"` with `author_source: "unknown"`. `runRegisteredMutationGuardForTest`
2135
+ resolves an omitted test `actor` from the context's `author` the same way. Preview cost is proportional to the tracker data
2112
2136
  staged, rather than unrelated root-layout project content.
2113
2137
 
2114
2138
  `itemDocumentToMutationOptions` is the companion full-document adapter. It
@@ -2365,7 +2389,16 @@ const certified = certifyCompleteListResult(candidate);
2365
2389
 
2366
2390
  `PmCompleteListValidationError.receipt` lists every failed invariant and carries
2367
2391
  the exact recovery command
2368
- `pm list --all --full --strict-read --no-truncate --output-budget unbounded --json`.
2392
+ `pm list --all --output-include full --strict-read --no-truncate --output-budget unbounded --output-limit unbounded --json`
2393
+ with its SDK equivalent `await client.listAllComplete()`. `--no-truncate` is
2394
+ load-bearing here: it lifts `pm list`'s own page limit and is the flag that
2395
+ echoes `filters.no_truncate`, which certification requires. A refused request that
2396
+ asked for bodies gets a recovery that asks for them too (`--include-body` and
2397
+ `listAllComplete({ includeBody: true })`): pass the request's options as
2398
+ `certifyCompleteListResult(candidate, { includeBody: true })`, or let the
2399
+ certifier read the `filters.include_body` record the list envelope carries
2400
+ ([pm-gh1728](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-gh1728.toon),
2401
+ tracker record excluded from npm).
2369
2402
  The helper never infers completeness from a large limit: derived-index reads,
2370
2403
  terminal-state filtering, duplicate ids, cursor/session projection, compaction,
2371
2404
  and any omission receipt all prevent certification.
@@ -2873,7 +2906,24 @@ api.registerCommand({
2873
2906
  The handler must return a structured object. Each declared path must contain
2874
2907
  an array or object map; paths may be nested, unique and non-overlapping. Use
2875
2908
  `row_keys: []` for a singleton result. Activation snapshots the declaration,
2876
- and the host validates the returned collections before projecting them. Avoid
2909
+ and the host validates the collections of the result it delivers before
2910
+ projecting them or rendering them. That result is the handler's own unless an
2911
+ `output_format` service returns a structured replacement: the replacement is
2912
+ then validated in its place, so a replacement that supplies the declared rows
2913
+ is admitted even when the handler's result lacks them, while a string rendering
2914
+ replaces nothing and the handler's result is validated. A command that
2915
+ delivers a compact receipt (for example `{ ok: true, output: "report.md" }`
2916
+ after writing a file) keeps returning its rows, or an empty collection, and
2917
+ lets its `output_format` service render the receipt; a receipt-only result is
2918
+ refused with `extension_read_output_invalid`. `runRegisteredCommandForTest`
2919
+ and `createExtensionTestHarness().runCommand()` run a handled read-output
2920
+ result through native `formatOutput` itself, inside an isolated runtime that
2921
+ holds the activation's commands, services and registrations: the
2922
+ mutation-receipt projection, command-result overrides, suppressed host
2923
+ output, `output_format` services and encoding resolution apply as they do
2924
+ natively, so a package test fails exactly where the native CLI would
2925
+ ([pm-gh1729](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-gh1729.toon),
2926
+ tracker record excluded from npm). Avoid
2877
2927
  reserved metadata and prototype property names. The declaration promises a
2878
2928
  read-only handler; writers and undeclared commands keep refusing read controls,
2879
2929
  and native commands/actions retain their existing contracts. A declaration
@@ -3162,7 +3212,7 @@ definition-driven normalizer
3162
3212
  ([pm-gh1665](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-gh1665.toon),
3163
3213
  tracker record excluded from npm). A direct caller should pass the handler key.
3164
3214
  The flag's own spellings (`status-filter`, `--status-filter`, or its short
3165
- letter) fold into the same key, and undeclared keys pass through unchanged. Two
3215
+ letter) fold into the same key. Two
3166
3216
  spellings of one flag with different values are refused with
3167
3217
  `extension_option_spelling_conflict` (exit 2) instead of silently picking one.
3168
3218
  CLI argv gets the same refusal: `pm demo-brief --status-filter open -s closed`
@@ -3178,6 +3228,46 @@ await client.run("demo-brief", { options: { statusFilter: "closed" } }); // hand
3178
3228
  await client.run("demo-brief", { options: { "status-filter": "closed" } }); // same result
3179
3229
  ```
3180
3230
 
3231
+ Direct callers get the refusals CLI argv gets, with the same codes and exit 2,
3232
+ before the handler runs
3233
+ ([pm-gh1726](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-gh1726.toon),
3234
+ [pm-gh1727](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-gh1727.toon),
3235
+ tracker records excluded from npm). Match on the code, never the message:
3236
+
3237
+ | Condition | Code | Structured fields |
3238
+ |---|---|---|
3239
+ | A required flag is missing (an empty array counts as missing for a `list` flag) | `missing_required_option` | `flag`, `field` (the handler key), `recovery.missing` |
3240
+ | A key is neither a declared spelling nor host-owned | `unknown_option` | `flag` (dashed form of the key) |
3241
+ | A disabled flag is supplied | `extension_option_disabled` | `flag` |
3242
+ | An array is passed to a flag that is not `list`/`repeatable`, or a strict value is malformed | `extension_flag_value_invalid` | `flag` |
3243
+
3244
+ Host-owned keys pass through untouched: every reserved host flag in camel case,
3245
+ snake_case or dashed form (`json`, `outputBudget`, `output_budget`, `pmPath`,
3246
+ `--json`), the positive key of each `--no-*` switch, and the action-transport
3247
+ keys `force`, `subcommand`, `inputResponses` and `requestState`. The
3248
+ unknown-key refusal applies to extension-created commands only: on a command
3249
+ path core itself registers that an extension extends or overrides (`list`;
3250
+ package-owned compatibility paths such as `calendar` or `guide` stay strict),
3251
+ the native contract
3252
+ (its aliases, negated flags and settings-dependent runtime fields) owns every
3253
+ key the extension does not declare, so those keys keep passing through. A
3254
+ command that declares no flags still receives every key (pm-4of199, below).
3255
+ A `repeatable` declaration counts as `list` for these checks, as the loader
3256
+ expands it, also when `normalizeDirectExtensionCommandOptions` is called
3257
+ directly. An
3258
+ extension action also keeps the caller's values as given: the native
3259
+ `tags`-to-CSV and `dep`-to-array rewrites of core commands do not apply to it.
3260
+ On the CLI, each bare occurrence of a repeatable boolean switch reaches the
3261
+ handler as `true` (`--many --many` is `[true, true]`). A direct caller's negated
3262
+ spelling of a declared boolean (`no-many`, `--no-many`) inverts token by token
3263
+ and is then judged exactly as the canonical spelling: on a `list` boolean,
3264
+ `{ "no-many": "true,false" }` is `{ many: [false, true] }`, a blank segment is
3265
+ refused under `value_validation: "strict"` and dropped otherwise, and
3266
+ `{ many: false, "no-many": true }` is one value, not a spelling conflict. A
3267
+ `repeatable` boolean keeps each occurrence atomic, so `"true,false"` is one
3268
+ malformed token under either spelling. A value that is not a boolean token
3269
+ (`"bogus"`) cannot be inverted and is refused with `extension_flag_value_invalid`.
3270
+
3181
3271
  `pm contracts --command <command> --flags-only --json` publishes the key as
3182
3272
  `sdk_option` on every extension-declared row, and marks the row `owner:
3183
3273
  "extension"`. The same entry lists the host flags the command inherits under
@@ -4138,6 +4228,22 @@ the host-bound `sdk` service bundle). Importers can therefore compose native PM
4138
4228
  actions and relationship stores without spawning the CLI or recursively
4139
4229
  activating packages.
4140
4230
 
4231
+ Strict trackers need no invented values from an importer
4232
+ ([pm-gh1713](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/features/pm-gh1713.toon)). When the source system
4233
+ does not know a strict-required scalar, the create step can defer it with a
4234
+ reason: `create({ ..., defer: ["deadline", "assignee"], deferReason:
4235
+ "Imported from GitHub issue 42" })`. The same options work in a
4236
+ `commitItemMutations` create step and through MCP `pm_create`. Deferrable
4237
+ fields are `deadline`, `assignee`, `acceptance_criteria` and
4238
+ `estimated_minutes`. The item stores `deferred_fields` (format 4), and any
4239
+ later write that supplies a value resolves that entry. Validate lists open
4240
+ deferrals as curation work, and strict close refuses the item with
4241
+ `close_validation_deferred_fields` until every deferred field has a value.
4242
+ Package import adapters (`commitImportedItem`) now run the tracker's
4243
+ `beforeMutation` guards as operation `import`, with the importer's actor. A
4244
+ guard denial propagates as a refusal; only a held item lock returns the
4245
+ skippable `conflictWarning`.
4246
+
4141
4247
  By default the auto-created command only has a handler. Pass an optional third
4142
4248
  `ImportExportRegistrationOptions` argument to make it a first-class command with a
4143
4249
  description, flags, intent, examples, failure hints, and positional arguments —
@@ -12,7 +12,7 @@ This file is generated by `listPmFlagLexicon()`. Compatibility aliases do not co
12
12
  | `packages` | extensions | 57 | 57 |
13
13
  | `install` | extensions | 28 | 28 |
14
14
  | `upgrade` | extensions | 30 | 30 |
15
- | `create` | intake | 103 | 103 |
15
+ | `create` | intake | 105 | 105 |
16
16
  | `copy` | intake | 25 | 25 |
17
17
  | `focus` | intake | 23 | 23 |
18
18
  | `list` | context | 87 | 87 |
package/marketplace.json CHANGED
@@ -1 +1 @@
1
- {"name":"pm","owner":{"name":"unbrained","url":"https://github.com/unbraind/pm-cli"},"description":"Official marketplace for pm CLI — native git-based project management for Claude Code and AI coding agents.","version":"2026.11.14","plugins":[{"name":"pm-claude","source":"./plugins/pm-claude","description":"Native pm CLI integration for Claude Code — 32 MCP tools, 14 workflow skills with slash invocations, 4 subagents, hybrid TUI task tracking, session context injection, and coordination subagents for git-based project management without leaving Claude Code.","version":"2026.11.14","author":{"name":"unbrained","url":"https://github.com/unbraind/pm-cli"},"homepage":"https://github.com/unbraind/pm-cli","repository":"https://github.com/unbraind/pm-cli","license":"MIT","keywords":["pm-cli","project-management","mcp","tasks","agents","workflows","git-native","task-tracker","ai"],"category":"productivity"}]}
1
+ {"name":"pm","owner":{"name":"unbrained","url":"https://github.com/unbraind/pm-cli"},"description":"Official marketplace for pm CLI — native git-based project management for Claude Code and AI coding agents.","version":"2026.11.15","plugins":[{"name":"pm-claude","source":"./plugins/pm-claude","description":"Native pm CLI integration for Claude Code — 32 MCP tools, 14 workflow skills with slash invocations, 4 subagents, hybrid TUI task tracking, session context injection, and coordination subagents for git-based project management without leaving Claude Code.","version":"2026.11.15","author":{"name":"unbrained","url":"https://github.com/unbraind/pm-cli"},"homepage":"https://github.com/unbraind/pm-cli","repository":"https://github.com/unbraind/pm-cli","license":"MIT","keywords":["pm-cli","project-management","mcp","tasks","agents","workflows","git-native","task-tracker","ai"],"category":"productivity"}]}
package/package.json CHANGED
@@ -1,11 +1,14 @@
1
1
  {
2
2
  "name": "@unbrained/pm-cli",
3
- "version": "2026.11.14",
3
+ "version": "2026.11.15",
4
4
  "description": "Git-native project management CLI for humans and agents.",
5
5
  "type": "module",
6
6
  "packageManager": "pnpm@11.28.5",
7
- "author": "unbrained",
8
- "homepage": "https://github.com/unbraind/pm-cli#readme",
7
+ "author": {
8
+ "name": "Stefan Preu",
9
+ "url": "https://preu.at"
10
+ },
11
+ "homepage": "https://pm-cli.unbrained.dev",
9
12
  "repository": {
10
13
  "type": "git",
11
14
  "url": "git+https://github.com/unbraind/pm-cli.git"
@@ -1 +1 @@
1
- {"name":"@unbrained/pm-beads","version":"2026.11.14","private":true,"type":"module","description":"First-party pm package for importing Beads JSONL records.","homepage":"https://github.com/unbraind/pm-cli/tree/main/packages/pm-beads#readme","repository":{"type":"git","url":"git+https://github.com/unbraind/pm-cli.git","directory":"packages/pm-beads"},"bugs":{"url":"https://github.com/unbraind/pm-cli/issues"},"keywords":["pm-package","project-management","beads"],"pm":{"aliases":["beads"],"extensions":["extensions/beads"],"catalog":{"display_name":"Beads Import","category":"migration","summary":"Import Beads JSONL records into pm while preserving source IDs.","tags":["migration","beads","import"],"links":{"docs":"https://github.com/unbraind/pm-cli/tree/main/packages/pm-beads#readme","repository":"https://github.com/unbraind/pm-cli/tree/main/packages/pm-beads","report":"https://github.com/unbraind/pm-cli/issues"}},"docs":["README.md"],"examples":["README.md"]}}
1
+ {"name":"@unbrained/pm-beads","version":"2026.11.15","private":true,"type":"module","description":"First-party pm package for importing Beads JSONL records.","homepage":"https://github.com/unbraind/pm-cli/tree/main/packages/pm-beads#readme","repository":{"type":"git","url":"git+https://github.com/unbraind/pm-cli.git","directory":"packages/pm-beads"},"bugs":{"url":"https://github.com/unbraind/pm-cli/issues"},"keywords":["pm-package","project-management","beads"],"pm":{"aliases":["beads"],"extensions":["extensions/beads"],"catalog":{"display_name":"Beads Import","category":"migration","summary":"Import Beads JSONL records into pm while preserving source IDs.","tags":["migration","beads","import"],"links":{"docs":"https://github.com/unbraind/pm-cli/tree/main/packages/pm-beads#readme","repository":"https://github.com/unbraind/pm-cli/tree/main/packages/pm-beads","report":"https://github.com/unbraind/pm-cli/issues"}},"docs":["README.md"],"examples":["README.md"]}}
@@ -14,6 +14,8 @@ const commonFlags: FlagDefinition[] = [
14
14
  { long: "--body", value_name: "text", value_type: "string", description: "Body/markdown content" },
15
15
  { long: "--description", value_name: "text", value_type: "string", description: "Short description" },
16
16
  { long: "--message", value_name: "value", value_type: "string", description: "History message" },
17
+ // The handler reads inheritFocus, so it is declared: direct callers are refused undeclared keys (pm-gh1727).
18
+ { long: "--inherit-focus", value_type: "boolean", description: "Use saved focus as parent (default)" },
17
19
  ];
18
20
 
19
21
  const eventFlags: FlagDefinition[] = [
@@ -1 +1 @@
1
- {"name":"@unbrained/pm-calendar","version":"2026.11.14","private":true,"type":"module","description":"First-party pm package for calendar and agenda views.","homepage":"https://github.com/unbraind/pm-cli/tree/main/packages/pm-calendar#readme","repository":{"type":"git","url":"git+https://github.com/unbraind/pm-cli.git","directory":"packages/pm-calendar"},"bugs":{"url":"https://github.com/unbraind/pm-cli/issues"},"keywords":["pm-package","project-management","calendar","agenda"],"pm":{"aliases":["calendar"],"extensions":["extensions/calendar"],"catalog":{"display_name":"Calendar Views","category":"workflow","summary":"Show agenda, day, week, and month views for deadlines, reminders, and scheduled events.","tags":["calendar","agenda","workflow"],"links":{"docs":"https://github.com/unbraind/pm-cli/tree/main/packages/pm-calendar#readme","repository":"https://github.com/unbraind/pm-cli/tree/main/packages/pm-calendar","report":"https://github.com/unbraind/pm-cli/issues"}},"docs":["README.md"],"examples":["README.md"]}}
1
+ {"name":"@unbrained/pm-calendar","version":"2026.11.15","private":true,"type":"module","description":"First-party pm package for calendar and agenda views.","homepage":"https://github.com/unbraind/pm-cli/tree/main/packages/pm-calendar#readme","repository":{"type":"git","url":"git+https://github.com/unbraind/pm-cli.git","directory":"packages/pm-calendar"},"bugs":{"url":"https://github.com/unbraind/pm-cli/issues"},"keywords":["pm-package","project-management","calendar","agenda"],"pm":{"aliases":["calendar"],"extensions":["extensions/calendar"],"catalog":{"display_name":"Calendar Views","category":"workflow","summary":"Show agenda, day, week, and month views for deadlines, reminders, and scheduled events.","tags":["calendar","agenda","workflow"],"links":{"docs":"https://github.com/unbraind/pm-cli/tree/main/packages/pm-calendar#readme","repository":"https://github.com/unbraind/pm-cli/tree/main/packages/pm-calendar","report":"https://github.com/unbraind/pm-cli/issues"}},"docs":["README.md"],"examples":["README.md"]}}
@@ -1 +1 @@
1
- {"name":"@unbrained/pm-command-kit","version":"2026.11.14","private":true,"type":"module","description":"First-party pm exemplar package for the commands capability: registerCommand, registerFlags, and registerParser.","homepage":"https://github.com/unbraind/pm-cli/tree/main/packages/pm-command-kit#readme","repository":{"type":"git","url":"git+https://github.com/unbraind/pm-cli.git","directory":"packages/pm-command-kit"},"bugs":{"url":"https://github.com/unbraind/pm-cli/issues"},"keywords":["pm-package","project-management","sdk","commands","exemplar"],"pm":{"aliases":["command-kit"],"extensions":["extensions/command-kit"],"catalog":{"display_name":"Command Kit Exemplar","category":"sdk","summary":"Copy-paste-able exemplar for registerCommand, registerFlags, and registerParser.","tags":["sdk","commands","parser","exemplar"],"links":{"docs":"https://github.com/unbraind/pm-cli/tree/main/packages/pm-command-kit#readme","repository":"https://github.com/unbraind/pm-cli/tree/main/packages/pm-command-kit","report":"https://github.com/unbraind/pm-cli/issues"}},"docs":["README.md"],"examples":["README.md"]}}
1
+ {"name":"@unbrained/pm-command-kit","version":"2026.11.15","private":true,"type":"module","description":"First-party pm exemplar package for the commands capability: registerCommand, registerFlags, and registerParser.","homepage":"https://github.com/unbraind/pm-cli/tree/main/packages/pm-command-kit#readme","repository":{"type":"git","url":"git+https://github.com/unbraind/pm-cli.git","directory":"packages/pm-command-kit"},"bugs":{"url":"https://github.com/unbraind/pm-cli/issues"},"keywords":["pm-package","project-management","sdk","commands","exemplar"],"pm":{"aliases":["command-kit"],"extensions":["extensions/command-kit"],"catalog":{"display_name":"Command Kit Exemplar","category":"sdk","summary":"Copy-paste-able exemplar for registerCommand, registerFlags, and registerParser.","tags":["sdk","commands","parser","exemplar"],"links":{"docs":"https://github.com/unbraind/pm-cli/tree/main/packages/pm-command-kit#readme","repository":"https://github.com/unbraind/pm-cli/tree/main/packages/pm-command-kit","report":"https://github.com/unbraind/pm-cli/issues"}},"docs":["README.md"],"examples":["README.md"]}}
@@ -1 +1 @@
1
- {"name":"@unbrained/pm-digital-twin","version":"2026.11.14","private":true,"type":"module","description":"Beyond-PM exemplar: a temporal production-facility digital twin built entirely on public pm SDK and extension primitives.","homepage":"https://github.com/unbraind/pm-cli/tree/main/packages/pm-digital-twin#readme","repository":{"type":"git","url":"git+https://github.com/unbraind/pm-cli.git","directory":"packages/pm-digital-twin"},"bugs":{"url":"https://github.com/unbraind/pm-cli/issues"},"keywords":["pm-package","sdk","digital-twin","event-sourcing","temporal-graph","exemplar"],"pm":{"aliases":["digital-twin","twin"],"extensions":["extensions/digital-twin"],"catalog":{"display_name":"Digital Twin SDK Exemplar","category":"sdk","summary":"Temporal facility graph proving event replay, point-in-time state, invariants, federation, checkpoints, and compact exports through public SDK contracts.","tags":["sdk","digital-twin","event-sourcing","graph","offline-first","exemplar"],"links":{"docs":"https://github.com/unbraind/pm-cli/tree/main/packages/pm-digital-twin#readme","repository":"https://github.com/unbraind/pm-cli/tree/main/packages/pm-digital-twin","report":"https://github.com/unbraind/pm-cli/tree/main/packages/pm-digital-twin/GAP_REPORT.md"}},"docs":["README.md","GAP_REPORT.md"],"examples":["README.md"]}}
1
+ {"name":"@unbrained/pm-digital-twin","version":"2026.11.15","private":true,"type":"module","description":"Beyond-PM exemplar: a temporal production-facility digital twin built entirely on public pm SDK and extension primitives.","homepage":"https://github.com/unbraind/pm-cli/tree/main/packages/pm-digital-twin#readme","repository":{"type":"git","url":"git+https://github.com/unbraind/pm-cli.git","directory":"packages/pm-digital-twin"},"bugs":{"url":"https://github.com/unbraind/pm-cli/issues"},"keywords":["pm-package","sdk","digital-twin","event-sourcing","temporal-graph","exemplar"],"pm":{"aliases":["digital-twin","twin"],"extensions":["extensions/digital-twin"],"catalog":{"display_name":"Digital Twin SDK Exemplar","category":"sdk","summary":"Temporal facility graph proving event replay, point-in-time state, invariants, federation, checkpoints, and compact exports through public SDK contracts.","tags":["sdk","digital-twin","event-sourcing","graph","offline-first","exemplar"],"links":{"docs":"https://github.com/unbraind/pm-cli/tree/main/packages/pm-digital-twin#readme","repository":"https://github.com/unbraind/pm-cli/tree/main/packages/pm-digital-twin","report":"https://github.com/unbraind/pm-cli/tree/main/packages/pm-digital-twin/GAP_REPORT.md"}},"docs":["README.md","GAP_REPORT.md"],"examples":["README.md"]}}
@@ -1 +1 @@
1
- {"name":"@unbrained/pm-governance-audit","version":"2026.11.14","private":true,"type":"module","description":"First-party pm package for governance audit and normalization workflows.","homepage":"https://github.com/unbraind/pm-cli/tree/main/packages/pm-governance-audit#readme","repository":{"type":"git","url":"git+https://github.com/unbraind/pm-cli.git","directory":"packages/pm-governance-audit"},"bugs":{"url":"https://github.com/unbraind/pm-cli/issues"},"keywords":["pm-package","project-management","governance","audit","normalize","hooks"],"pm":{"aliases":["governance-audit","audit"],"extensions":["extensions/governance-audit"],"catalog":{"display_name":"Governance Audit","category":"governance","summary":"Run dedupe audits, comments audits, and normalize sweeps as package-owned workflows.","tags":["governance","audit","normalize","hooks"],"links":{"docs":"https://github.com/unbraind/pm-cli/tree/main/packages/pm-governance-audit#readme","repository":"https://github.com/unbraind/pm-cli/tree/main/packages/pm-governance-audit","report":"https://github.com/unbraind/pm-cli/issues"}},"docs":["README.md"],"examples":["README.md"]}}
1
+ {"name":"@unbrained/pm-governance-audit","version":"2026.11.15","private":true,"type":"module","description":"First-party pm package for governance audit and normalization workflows.","homepage":"https://github.com/unbraind/pm-cli/tree/main/packages/pm-governance-audit#readme","repository":{"type":"git","url":"git+https://github.com/unbraind/pm-cli.git","directory":"packages/pm-governance-audit"},"bugs":{"url":"https://github.com/unbraind/pm-cli/issues"},"keywords":["pm-package","project-management","governance","audit","normalize","hooks"],"pm":{"aliases":["governance-audit","audit"],"extensions":["extensions/governance-audit"],"catalog":{"display_name":"Governance Audit","category":"governance","summary":"Run dedupe audits, comments audits, and normalize sweeps as package-owned workflows.","tags":["governance","audit","normalize","hooks"],"links":{"docs":"https://github.com/unbraind/pm-cli/tree/main/packages/pm-governance-audit#readme","repository":"https://github.com/unbraind/pm-cli/tree/main/packages/pm-governance-audit","report":"https://github.com/unbraind/pm-cli/issues"}},"docs":["README.md"],"examples":["README.md"]}}
@@ -1 +1 @@
1
- {"name":"@unbrained/pm-guide-shell","version":"2026.11.14","private":true,"type":"module","description":"First-party pm package for guide and shell completion workflows.","homepage":"https://github.com/unbraind/pm-cli/tree/main/packages/pm-guide-shell#readme","repository":{"type":"git","url":"git+https://github.com/unbraind/pm-cli.git","directory":"packages/pm-guide-shell"},"bugs":{"url":"https://github.com/unbraind/pm-cli/issues"},"keywords":["pm-package","project-management","guide","completion","shell"],"pm":{"aliases":["guide-shell"],"extensions":["extensions/guide-shell"],"catalog":{"display_name":"Guide + Shell UX","category":"workflow","summary":"Restore guide documentation and shell completion commands as package-owned UX surfaces.","tags":["guide","completion","shell"],"links":{"docs":"https://github.com/unbraind/pm-cli/tree/main/packages/pm-guide-shell#readme","repository":"https://github.com/unbraind/pm-cli/tree/main/packages/pm-guide-shell","report":"https://github.com/unbraind/pm-cli/issues"}},"docs":["README.md"],"examples":["README.md"]}}
1
+ {"name":"@unbrained/pm-guide-shell","version":"2026.11.15","private":true,"type":"module","description":"First-party pm package for guide and shell completion workflows.","homepage":"https://github.com/unbraind/pm-cli/tree/main/packages/pm-guide-shell#readme","repository":{"type":"git","url":"git+https://github.com/unbraind/pm-cli.git","directory":"packages/pm-guide-shell"},"bugs":{"url":"https://github.com/unbraind/pm-cli/issues"},"keywords":["pm-package","project-management","guide","completion","shell"],"pm":{"aliases":["guide-shell"],"extensions":["extensions/guide-shell"],"catalog":{"display_name":"Guide + Shell UX","category":"workflow","summary":"Restore guide documentation and shell completion commands as package-owned UX surfaces.","tags":["guide","completion","shell"],"links":{"docs":"https://github.com/unbraind/pm-cli/tree/main/packages/pm-guide-shell#readme","repository":"https://github.com/unbraind/pm-cli/tree/main/packages/pm-guide-shell","report":"https://github.com/unbraind/pm-cli/issues"}},"docs":["README.md"],"examples":["README.md"]}}
@@ -1 +1 @@
1
- {"name":"@unbrained/pm-kanban","version":"2026.11.14","private":true,"type":"module","description":"First-party pm archetype package: a complete Kanban continuous-flow profile built on public SDK primitives.","homepage":"https://github.com/unbraind/pm-cli/tree/main/packages/pm-kanban#readme","repository":{"type":"git","url":"git+https://github.com/unbraind/pm-cli.git","directory":"packages/pm-kanban"},"bugs":{"url":"https://github.com/unbraind/pm-cli/issues"},"keywords":["pm-package","project-management","sdk","profile","archetype","kanban","exemplar"],"pm":{"aliases":["kanban"],"extensions":["extensions/kanban"],"catalog":{"display_name":"Kanban Archetype","category":"sdk","summary":"Installable Kanban continuous-flow archetype: Card item type, flow fields, and a ProjectProfileDefinition built on public SDK primitives.","tags":["sdk","profile","archetype","kanban","schema","exemplar"],"links":{"docs":"https://github.com/unbraind/pm-cli/tree/main/packages/pm-kanban#readme","repository":"https://github.com/unbraind/pm-cli/tree/main/packages/pm-kanban","report":"https://github.com/unbraind/pm-cli/issues"}},"docs":["README.md"],"examples":["README.md"]}}
1
+ {"name":"@unbrained/pm-kanban","version":"2026.11.15","private":true,"type":"module","description":"First-party pm archetype package: a complete Kanban continuous-flow profile built on public SDK primitives.","homepage":"https://github.com/unbraind/pm-cli/tree/main/packages/pm-kanban#readme","repository":{"type":"git","url":"git+https://github.com/unbraind/pm-cli.git","directory":"packages/pm-kanban"},"bugs":{"url":"https://github.com/unbraind/pm-cli/issues"},"keywords":["pm-package","project-management","sdk","profile","archetype","kanban","exemplar"],"pm":{"aliases":["kanban"],"extensions":["extensions/kanban"],"catalog":{"display_name":"Kanban Archetype","category":"sdk","summary":"Installable Kanban continuous-flow archetype: Card item type, flow fields, and a ProjectProfileDefinition built on public SDK primitives.","tags":["sdk","profile","archetype","kanban","schema","exemplar"],"links":{"docs":"https://github.com/unbraind/pm-cli/tree/main/packages/pm-kanban#readme","repository":"https://github.com/unbraind/pm-cli/tree/main/packages/pm-kanban","report":"https://github.com/unbraind/pm-cli/issues"}},"docs":["README.md"],"examples":["README.md"]}}