@unbrained/pm-cli 2026.8.19 → 2026.8.20

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 (146) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +19 -0
  3. package/dist/cli/register-list-query.js +12 -10
  4. package/dist/cli/register-structured-mutation.d.ts +2 -0
  5. package/dist/cli/register-structured-mutation.js +29 -6
  6. package/dist/cli-bundle/bundle-manifest.json +151 -143
  7. package/dist/cli-bundle/chunks/{chunk-4THEB6PD.js → chunk-2RDVGYWE.js} +12 -12
  8. package/dist/cli-bundle/chunks/{chunk-BHYMXLAE.js → chunk-4GB2LTOQ.js} +2 -2
  9. package/dist/cli-bundle/chunks/{chunk-TOXJM4WA.js → chunk-7BRF2BX2.js} +2 -2
  10. package/dist/cli-bundle/chunks/chunk-BLVQHFSY.js +35 -0
  11. package/dist/cli-bundle/chunks/chunk-CU25EQVV.js +5 -0
  12. package/dist/cli-bundle/chunks/{chunk-4NRRH7AM.js → chunk-K3EN3LK2.js} +2 -2
  13. package/dist/cli-bundle/chunks/{chunk-OIOKV6NO.js → chunk-L4LGPBJU.js} +49 -49
  14. package/dist/cli-bundle/chunks/chunk-RS3IV2R6.js +197 -0
  15. package/dist/cli-bundle/chunks/chunk-TSMWLCHS.js +3 -0
  16. package/dist/cli-bundle/chunks/chunk-US2ZQW2M.js +77 -0
  17. package/dist/cli-bundle/chunks/{chunk-QXSH7BLM.js → chunk-XYDDWBZN.js} +2 -2
  18. package/dist/cli-bundle/chunks/register-list-query-JSAQCVOC.js +11 -0
  19. package/dist/cli-bundle/chunks/{register-mutation-AUWVCW4M.js → register-mutation-XJPAW63D.js} +20 -20
  20. package/dist/cli-bundle/chunks/{register-operations-PZQPHXW5.js → register-operations-DSOSB2XQ.js} +2 -2
  21. package/dist/cli-bundle/chunks/{register-setup-I4LUHGVW.js → register-setup-QUR6QL2C.js} +2 -2
  22. package/dist/cli-bundle/focused-chunks/{chunk-DKPLYW3L.js → chunk-325UXIO7.js} +2 -2
  23. package/dist/cli-bundle/focused-chunks/chunk-5L7M4AI7.js +2 -0
  24. package/dist/cli-bundle/focused-chunks/{chunk-EF6ZS5GH.js → chunk-6AHG2YW7.js} +2 -2
  25. package/dist/cli-bundle/focused-chunks/{chunk-MCZXYZAF.js → chunk-AZBACT5T.js} +2 -2
  26. package/dist/cli-bundle/focused-chunks/{chunk-VXDSU5MC.js → chunk-BLJCGGID.js} +2 -2
  27. package/dist/cli-bundle/focused-chunks/chunk-FUREQLQN.js +18 -0
  28. package/dist/cli-bundle/focused-chunks/{chunk-US7VEYZG.js → chunk-G3C5ERXG.js} +2 -2
  29. package/dist/cli-bundle/focused-chunks/{chunk-ZBIQQYMI.js → chunk-GXWQBE3T.js} +2 -2
  30. package/dist/cli-bundle/focused-chunks/{chunk-JDOMQ7VQ.js → chunk-JWKEDZJI.js} +3 -3
  31. package/dist/cli-bundle/focused-chunks/chunk-KYZ6JGPL.js +155 -0
  32. package/dist/cli-bundle/focused-chunks/{chunk-ESISGDAY.js → chunk-M32HFIQB.js} +2 -2
  33. package/dist/cli-bundle/focused-chunks/{chunk-EXBCLIBU.js → chunk-OM65KHGF.js} +2 -2
  34. package/dist/cli-bundle/focused-chunks/chunk-Q47EX4DI.js +2 -0
  35. package/dist/cli-bundle/focused-chunks/{chunk-BJRYFVSH.js → chunk-RIHDMCUM.js} +2 -2
  36. package/dist/cli-bundle/focused-chunks/chunk-T4ZFY7ZJ.js +16 -0
  37. package/dist/cli-bundle/focused-chunks/chunk-TDR5OGG3.js +2 -0
  38. package/dist/cli-bundle/focused-chunks/{chunk-ODHQEECS.js → chunk-UGSS4F5X.js} +2 -2
  39. package/dist/cli-bundle/focused-chunks/chunk-Z3PLWSGM.js +2 -0
  40. package/dist/cli-bundle/main.js +2 -2
  41. package/dist/cli-bundle/sdk-authoring.js +1 -1
  42. package/dist/cli-bundle/sdk-contracts.js +2 -2
  43. package/dist/cli-bundle/sdk-core.js +41 -41
  44. package/dist/cli-bundle/sdk-governance.js +1 -1
  45. package/dist/cli-bundle/sdk-graph.js +1 -1
  46. package/dist/cli-bundle/sdk-merge.js +31 -31
  47. package/dist/cli-bundle/sdk-query.js +1 -1
  48. package/dist/cli-bundle/sdk-runtime.js +1 -1
  49. package/dist/cli-bundle/sdk-testing.js +1 -1
  50. package/dist/cli-bundle/sdk.js +5 -5
  51. package/dist/core/output/mutation-projection.js +26 -2
  52. package/dist/core/shared/constants.d.ts +1 -5
  53. package/dist/core/shared/constants.js +3 -81
  54. package/dist/core/shared/item-metadata-contract.d.ts +14 -0
  55. package/dist/core/shared/item-metadata-contract.js +90 -0
  56. package/dist/core/store/item-store.d.ts +60 -0
  57. package/dist/core/store/item-store.js +22 -5
  58. package/dist/sdk/agent/closed-domain-contracts.d.ts +25 -0
  59. package/dist/sdk/agent/closed-domain-contracts.js +140 -0
  60. package/dist/sdk/agent/refusal-closure.d.ts +13 -1
  61. package/dist/sdk/agent/refusal-closure.js +45 -3
  62. package/dist/sdk/agent/refusal-reachability.d.ts +26 -0
  63. package/dist/sdk/agent/refusal-reachability.js +26 -2
  64. package/dist/sdk/agent-capability-contracts.js +6 -11
  65. package/dist/sdk/cli-contracts/completeness.js +8 -2
  66. package/dist/sdk/cli-contracts/enum-contracts.d.ts +4 -2
  67. package/dist/sdk/cli-contracts/enum-contracts.js +16 -6
  68. package/dist/sdk/cli-contracts/flag-contracts.d.ts +2 -0
  69. package/dist/sdk/cli-contracts/flag-contracts.js +11 -2
  70. package/dist/sdk/cli-contracts/flag-lexicon-contracts.d.ts +19 -2
  71. package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +105 -5
  72. package/dist/sdk/cli-contracts/grammar-contracts.d.ts +2 -2
  73. package/dist/sdk/cli-contracts/grammar-contracts.js +5 -2
  74. package/dist/sdk/cli-contracts/runtime-contracts.js +7 -3
  75. package/dist/sdk/cli-contracts/tool-schema.js +7 -2
  76. package/dist/sdk/cli-contracts.d.ts +2 -2
  77. package/dist/sdk/cli-contracts.js +4 -4
  78. package/dist/sdk/contracts.d.ts +1 -0
  79. package/dist/sdk/contracts.js +3 -2
  80. package/dist/sdk/core.d.ts +1 -1
  81. package/dist/sdk/core.js +3 -3
  82. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +74 -2
  83. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +112 -40
  84. package/dist/sdk/index.d.ts +5 -3
  85. package/dist/sdk/index.js +6 -4
  86. package/dist/sdk/init-agent-guidance.d.ts +5 -3
  87. package/dist/sdk/init-agent-guidance.js +69 -9
  88. package/dist/sdk/lifecycle/mcp-actions.d.ts +18 -0
  89. package/dist/sdk/lifecycle/mcp-actions.js +52 -0
  90. package/dist/sdk/lifecycle/reopen.d.ts +44 -0
  91. package/dist/sdk/lifecycle/reopen.js +69 -0
  92. package/dist/sdk/lifecycle/update.d.ts +31 -0
  93. package/dist/sdk/lifecycle/update.js +95 -13
  94. package/dist/sdk/query/get.d.ts +1 -1
  95. package/dist/sdk/query/get.js +18 -52
  96. package/dist/sdk/query/list.d.ts +7 -21
  97. package/dist/sdk/query/list.js +35 -49
  98. package/dist/sdk/query/projection-contracts.d.ts +33 -0
  99. package/dist/sdk/query/projection-contracts.js +185 -0
  100. package/dist/sdk/query/search-contracts.d.ts +2 -1
  101. package/dist/sdk/query/search-contracts.js +18 -87
  102. package/dist/sdk/query/search.d.ts +15 -0
  103. package/dist/sdk/query/search.js +31 -5
  104. package/dist/sdk/runtime-primitives.d.ts +1 -1
  105. package/dist/sdk/runtime-primitives.js +3 -3
  106. package/dist/sdk/runtime.d.ts +6 -0
  107. package/dist/sdk/runtime.js +18 -14
  108. package/dist/sdk/similarity.d.ts +13 -0
  109. package/dist/sdk/similarity.js +32 -6
  110. package/docs/COMMANDS.md +13 -1
  111. package/docs/README.md +1 -0
  112. package/docs/RECURRENCE_RECOVERY_CONTRACTS.md +114 -0
  113. package/docs/SDK.md +10 -2
  114. package/docs/SDK_CONTEXT_INTEGRITY.md +45 -0
  115. package/docs/generated/AGENT_COMMAND_SURFACE.md +1 -1
  116. package/docs/performance/sdk-entrypoint-import-costs.md +14 -21
  117. package/marketplace.json +2 -2
  118. package/package.json +5 -5
  119. package/packages/pm-beads/package.json +1 -1
  120. package/packages/pm-calendar/package.json +1 -1
  121. package/packages/pm-command-kit/package.json +1 -1
  122. package/packages/pm-digital-twin/package.json +1 -1
  123. package/packages/pm-governance-audit/package.json +1 -1
  124. package/packages/pm-guide-shell/package.json +1 -1
  125. package/packages/pm-kanban/package.json +1 -1
  126. package/packages/pm-lifecycle-hooks/package.json +1 -1
  127. package/packages/pm-linked-test-adapters/package.json +1 -1
  128. package/packages/pm-search-advanced/package.json +1 -1
  129. package/packages/pm-templates/package.json +1 -1
  130. package/packages/pm-todos/package.json +1 -1
  131. package/packages/pm-vcs/package.json +1 -1
  132. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  133. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  134. package/sdk/public-surface.json +387 -25
  135. package/dist/cli-bundle/chunks/chunk-GWMXAQOD.js +0 -197
  136. package/dist/cli-bundle/chunks/chunk-HVFQTLYM.js +0 -35
  137. package/dist/cli-bundle/chunks/chunk-OI4XI562.js +0 -5
  138. package/dist/cli-bundle/chunks/chunk-SARFF5H5.js +0 -3
  139. package/dist/cli-bundle/chunks/chunk-YBMRWW4E.js +0 -77
  140. package/dist/cli-bundle/chunks/register-list-query-Y56KINDU.js +0 -11
  141. package/dist/cli-bundle/focused-chunks/chunk-34QBIYZI.js +0 -155
  142. package/dist/cli-bundle/focused-chunks/chunk-L623ZPNK.js +0 -2
  143. package/dist/cli-bundle/focused-chunks/chunk-PRHY2IMX.js +0 -18
  144. package/dist/cli-bundle/focused-chunks/chunk-RZU5U6Q7.js +0 -2
  145. package/dist/cli-bundle/focused-chunks/chunk-YBMGXBFV.js +0 -16
  146. package/dist/cli-bundle/focused-chunks/chunk-YLVBJ6GF.js +0 -2
package/dist/sdk/index.js CHANGED
@@ -4,7 +4,7 @@
4
4
  * Defines public SDK APIs and package-author helpers for Index.
5
5
  */
6
6
 
7
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="3236ba3b-d3ac-5760-90a4-022ff103b952")}catch(e){}}();
7
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="69a0f0d4-50f9-5063-9cc6-64de2abac82e")}catch(e){}}();
8
8
  export { PM_COMMAND_CAPABILITY_CONTRACTS, PM_COMMAND_VISIBILITY_CONTRACTS, PM_MCP_PROMPT_CONTRACTS, PM_MCP_RESOURCE_CONTRACTS, PM_MCP_TOOL_COMMAND_CONTRACTS, listPmCommandsForFamily, listPmCommandsForTier, listPmMcpToolsForProfile, renderPmCommandVisibilityMarkdown, resolvePmCommandCapabilityFamily, resolvePmCommandVisibilityTier, } from "./agent-capability-contracts.js";
9
9
  export * from "./cli-contracts/grammar-contracts.js";
10
10
  export * from "./agent-session-context.js";
@@ -53,7 +53,7 @@ export { PROFILE_SUBCOMMANDS, formatProfileApplyHuman, formatProfileLintHuman, f
53
53
  export * from "./extension-contracts.js";
54
54
  export { RESERVED_ITEM_FIELD_NAMES } from "../core/extensions/item-fields.js";
55
55
  export { PM_PACKAGE_CONVENTIONAL_RESOURCE_ROOTS, PM_PACKAGE_RESOURCE_KINDS, collectPackageExtensionDirectories, readPmPackageManifest, } from "../core/packages/manifest.js";
56
- export { ACTIVITY_FLAG_CONTRACTS, ACTIVITY_COMMANDER_STRING_OPTION_CONTRACTS, AGGREGATE_FLAG_CONTRACTS, ASSURANCE_FLAG_CONTRACTS, APPEND_FLAG_CONTRACTS, CALENDAR_COMMANDER_STRING_OPTION_CONTRACTS, CALENDAR_FLAG_CONTRACTS, CLAIM_FLAG_CONTRACTS, CLOSE_ACTION_OPTION_KEYS, CLOSE_FLAG_CONTRACTS, CLOSE_MANY_FLAG_CONTRACTS, CLOSE_TASK_FLAG_CONTRACTS, COMMENTS_FLAG_CONTRACTS, COMPLETION_FLAG_CONTRACTS, CONFIG_FLAG_CONTRACTS, CONTEXT_COMMANDER_STRING_OPTION_CONTRACTS, CONTEXT_FLAG_CONTRACTS, CONTRACTS_FLAG_CONTRACTS, COPY_FLAG_CONTRACTS, CREATE_COMMANDER_OPTION_REGISTRATION_CONTRACTS, CREATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS, CREATE_COMMANDER_STRING_OPTION_CONTRACTS, CREATE_FLAG_CONTRACTS, DELETE_FLAG_CONTRACTS, DEPS_FLAG_CONTRACTS, DOCS_FLAG_CONTRACTS, EVAL_FLAG_CONTRACTS, EVENT_FLAG_CONTRACTS, EVENTS_FLAG_CONTRACTS, EXTENSION_ACTIVATE_FLAG_CONTRACTS, EXTENSION_ADOPT_ALL_FLAG_CONTRACTS, EXTENSION_ADOPT_FLAG_CONTRACTS, EXTENSION_CATALOG_FLAG_CONTRACTS, EXTENSION_DEACTIVATE_FLAG_CONTRACTS, EXTENSION_DESCRIBE_FLAG_CONTRACTS, EXTENSION_DOCTOR_FLAG_CONTRACTS, EXTENSION_EXPLORE_FLAG_CONTRACTS, EXTENSION_FLAG_CONTRACTS, EXTENSION_INIT_FLAG_CONTRACTS, EXTENSION_INSTALL_FLAG_CONTRACTS, EXTENSION_MANAGE_FLAG_CONTRACTS, EXTENSION_MIGRATE_FLAG_CONTRACTS, EXTENSION_RELOAD_FLAG_CONTRACTS, EXTENSION_SCOPE_FLAG_CONTRACTS, EXTENSION_UNINSTALL_FLAG_CONTRACTS, FILES_FLAG_CONTRACTS, FOCUS_FLAG_CONTRACTS, GC_FLAG_CONTRACTS, GET_FLAG_CONTRACTS, GRAPH_FLAG_CONTRACTS, GLOBAL_FLAG_CONTRACTS, GUIDE_FLAG_CONTRACTS, HEALTH_FLAG_CONTRACTS, HISTORY_COMPACT_FLAG_CONTRACTS, HISTORY_FLAG_CONTRACTS, HISTORY_REDACT_FLAG_CONTRACTS, HISTORY_REPAIR_FLAG_CONTRACTS, HISTORY_AUTHOR_ACKNOWLEDGE_FLAG_CONTRACTS, INIT_FLAG_CONTRACTS, INSTALL_FLAG_CONTRACTS, ITEM_MUTATE_FLAG_CONTRACTS, ITEM_COMPLETE_FLAG_CONTRACTS, LEARNINGS_FLAG_CONTRACTS, LIST_COMMANDER_STRING_OPTION_CONTRACTS, LIST_FILTER_FLAG_CONTRACTS, MEET_FLAG_CONTRACTS, MERGE_FLAG_CONTRACTS, NEXT_COMMANDER_STRING_OPTION_CONTRACTS, NEXT_FLAG_CONTRACTS, NOTES_FLAG_CONTRACTS, PACKAGE_FLAG_CONTRACTS, PACKAGE_INIT_FLAG_CONTRACTS, PAUSE_TASK_FLAG_CONTRACTS, PLAN_CREATE_METADATA_PARAMETER_KEYS, PLAN_FLAG_CONTRACTS, PM_COMMAND_OUTPUT_BUDGET_CONTRACTS, PM_CLI_ONLY_TOOL_ACTION_WAIVERS, PM_CORE_COMMAND_NAMES, PM_EXTENSION_PACKAGE_ACTION_SUBCOMMANDS, PM_DEPRECATED_TOOL_ACTIONS, PM_DISCOVERABLE_TOOL_ACTIONS, PM_EXTENSION_CAPABILITY_CONTRACTS, PM_EXTENSION_POLICY_MODE_CONTRACTS, PM_EXTENSION_POLICY_SURFACE_CONTRACTS, PM_EXTENSION_SANDBOX_PROFILE_CONTRACTS, PM_EXTENSION_SERVICE_NAME_CONTRACTS, PM_EXTENSION_TRUST_MODE_CONTRACTS, PM_PROVIDER_TOOL_PARAMETERS_SCHEMA, PM_PROVIDER_TOOL_PARAMETERS_SCHEMA_VERSION, PM_TOOL_ACTIONS, analyzePmToolActionParity, PM_TOOL_ACTION_PARAMETER_CONTRACTS, PM_TOOL_PARAMETERS_SCHEMA, PM_TOOL_PARAMETERS_SCHEMA_MAJOR, PM_TOOL_PARAMETERS_SCHEMA_VERSION, PM_OUTPUT_BUDGET_CLASSES, PM_OUTPUT_DEGRADATION_STEPS, PROFILE_FLAG_CONTRACTS, REINDEX_FLAG_CONTRACTS, RELEASE_FLAG_CONTRACTS, REMIND_FLAG_CONTRACTS, RESTORE_FLAG_CONTRACTS, SCHEMA_FLAG_CONTRACTS, SEARCH_COMMANDER_STRING_OPTION_CONTRACTS, SEARCH_FLAG_CONTRACTS, START_TASK_FLAG_CONTRACTS, STATS_FLAG_CONTRACTS, DUPLICATES_FLAG_CONTRACTS, SUBCOMMAND_GLOBAL_FLAG_CONTRACTS, TELEMETRY_FLAG_CONTRACTS, TEST_ALL_FLAG_CONTRACTS, TEST_FLAG_CONTRACTS, TEST_RUNS_FLAG_CONTRACTS, TOOL_ACTIVITY_OPTION_CONTRACTS, TOOL_AGGREGATE_OPTION_CONTRACTS, TOOL_BULK_MUTATION_FILTER_OPTION_CONTRACT_SOURCE, TOOL_CALENDAR_OPTION_CONTRACTS, TOOL_CLOSE_MANY_FILTER_OPTION_CONTRACTS, TOOL_CONTEXT_OPTION_CONTRACTS, TOOL_CREATE_OPTION_CONTRACTS, TOOL_CREATE_OPTION_CONTRACT_SOURCE, TOOL_DEPS_OPTION_CONTRACTS, TOOL_GRAPH_OPTION_CONTRACTS, TOOL_LIST_FILTER_OPTION_CONTRACTS, TOOL_SEARCH_FILTER_OPTION_CONTRACTS, TOOL_SHARED_CREATE_UPDATE_OPTION_CONTRACTS, TOOL_SHARED_CREATE_UPDATE_OPTION_CONTRACT_SOURCE, TOOL_UPDATE_MANY_FILTER_OPTION_CONTRACTS, TOOL_UPDATE_OPTION_CONTRACTS, TOOL_UPDATE_OPTION_CONTRACT_SOURCE, verifyToolOptionCliParity, UPDATE_COMMANDER_OPTION_REGISTRATION_CONTRACTS, UPDATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS, UPDATE_COMMANDER_STRING_OPTION_CONTRACTS, UPDATE_FLAG_CONTRACTS, UPDATE_MANY_FLAG_CONTRACTS, UPGRADE_FLAG_CONTRACTS, VALIDATE_FLAG_CONTRACTS, WORKSPACE_FLAG_CONTRACTS, buildPmActionToolInputSchema, PM_TOOL_RESERVED_CUSTOM_FIELD_PROPERTIES, compactFlagAliasContracts, createPmCommandOutputBudget, definePmCommandOutputBudget, estimatePmOutputTokens, inferPmOutputBudgetClass, analyzeSdkCliParameterCompleteness, isPmExtensionCapabilityContract, isPmExtensionPolicyModeContract, isPmExtensionPolicySurfaceContract, isPmExtensionServiceNameContract, isPmToolAction, hasSubcommandFlagContractsForCommand, readFirstStringFromCommanderOptions, readFirstValueFromCommanderOptions, readStringArrayFromCommanderOptions, resolvePmPositionalActionFlagContracts, resolveSubcommandFlagContractsForCommand, resolvePmCommandOutputBudget, resolvePmToolCustomFieldCollision, toCompletionFlagString, withFlagAliasMetadata, } from "./cli-contracts.js";
56
+ export { ACTIVITY_FLAG_CONTRACTS, ACTIVITY_COMMANDER_STRING_OPTION_CONTRACTS, AGGREGATE_FLAG_CONTRACTS, ASSURANCE_FLAG_CONTRACTS, APPEND_FLAG_CONTRACTS, CALENDAR_COMMANDER_STRING_OPTION_CONTRACTS, CALENDAR_FLAG_CONTRACTS, CLAIM_FLAG_CONTRACTS, CLOSE_ACTION_OPTION_KEYS, CLOSE_FLAG_CONTRACTS, CLOSE_MANY_FLAG_CONTRACTS, CLOSE_TASK_FLAG_CONTRACTS, COMMENTS_FLAG_CONTRACTS, COMPLETION_FLAG_CONTRACTS, CONFIG_FLAG_CONTRACTS, CONTEXT_COMMANDER_STRING_OPTION_CONTRACTS, CONTEXT_FLAG_CONTRACTS, CONTRACTS_FLAG_CONTRACTS, COPY_FLAG_CONTRACTS, CREATE_COMMANDER_OPTION_REGISTRATION_CONTRACTS, CREATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS, CREATE_COMMANDER_STRING_OPTION_CONTRACTS, CREATE_FLAG_CONTRACTS, DELETE_FLAG_CONTRACTS, DEPS_FLAG_CONTRACTS, DOCS_FLAG_CONTRACTS, EVAL_FLAG_CONTRACTS, EVENT_FLAG_CONTRACTS, EVENTS_FLAG_CONTRACTS, EXTENSION_ACTIVATE_FLAG_CONTRACTS, EXTENSION_ADOPT_ALL_FLAG_CONTRACTS, EXTENSION_ADOPT_FLAG_CONTRACTS, EXTENSION_CATALOG_FLAG_CONTRACTS, EXTENSION_DEACTIVATE_FLAG_CONTRACTS, EXTENSION_DESCRIBE_FLAG_CONTRACTS, EXTENSION_DOCTOR_FLAG_CONTRACTS, EXTENSION_EXPLORE_FLAG_CONTRACTS, EXTENSION_FLAG_CONTRACTS, EXTENSION_INIT_FLAG_CONTRACTS, EXTENSION_INSTALL_FLAG_CONTRACTS, EXTENSION_MANAGE_FLAG_CONTRACTS, EXTENSION_MIGRATE_FLAG_CONTRACTS, EXTENSION_RELOAD_FLAG_CONTRACTS, EXTENSION_SCOPE_FLAG_CONTRACTS, EXTENSION_UNINSTALL_FLAG_CONTRACTS, FILES_FLAG_CONTRACTS, FOCUS_FLAG_CONTRACTS, GC_FLAG_CONTRACTS, GET_FLAG_CONTRACTS, GRAPH_FLAG_CONTRACTS, GLOBAL_FLAG_CONTRACTS, GUIDE_FLAG_CONTRACTS, HEALTH_FLAG_CONTRACTS, HISTORY_COMPACT_FLAG_CONTRACTS, HISTORY_FLAG_CONTRACTS, HISTORY_REDACT_FLAG_CONTRACTS, HISTORY_REPAIR_FLAG_CONTRACTS, HISTORY_AUTHOR_ACKNOWLEDGE_FLAG_CONTRACTS, INIT_FLAG_CONTRACTS, INSTALL_FLAG_CONTRACTS, ITEM_MUTATE_FLAG_CONTRACTS, ITEM_COMPLETE_FLAG_CONTRACTS, ITEM_REOPEN_FLAG_CONTRACTS, LEARNINGS_FLAG_CONTRACTS, LIST_COMMANDER_STRING_OPTION_CONTRACTS, LIST_FILTER_FLAG_CONTRACTS, MEET_FLAG_CONTRACTS, MERGE_FLAG_CONTRACTS, NEXT_COMMANDER_STRING_OPTION_CONTRACTS, NEXT_FLAG_CONTRACTS, NOTES_FLAG_CONTRACTS, PACKAGE_FLAG_CONTRACTS, PACKAGE_INIT_FLAG_CONTRACTS, PAUSE_TASK_FLAG_CONTRACTS, PLAN_CREATE_METADATA_PARAMETER_KEYS, PLAN_FLAG_CONTRACTS, PM_COMMAND_OUTPUT_BUDGET_CONTRACTS, PM_CLI_ONLY_TOOL_ACTION_WAIVERS, PM_CORE_COMMAND_NAMES, PM_EXTENSION_PACKAGE_ACTION_SUBCOMMANDS, PM_ITEM_ACTION_SUBCOMMANDS, PM_DEPRECATED_TOOL_ACTIONS, PM_DISCOVERABLE_TOOL_ACTIONS, PM_EXTENSION_CAPABILITY_CONTRACTS, PM_EXTENSION_POLICY_MODE_CONTRACTS, PM_EXTENSION_POLICY_SURFACE_CONTRACTS, PM_EXTENSION_SANDBOX_PROFILE_CONTRACTS, PM_EXTENSION_SERVICE_NAME_CONTRACTS, PM_EXTENSION_TRUST_MODE_CONTRACTS, PM_PROVIDER_TOOL_PARAMETERS_SCHEMA, PM_PROVIDER_TOOL_PARAMETERS_SCHEMA_VERSION, PM_TOOL_ACTIONS, analyzePmToolActionParity, PM_TOOL_ACTION_PARAMETER_CONTRACTS, PM_TOOL_PARAMETERS_SCHEMA, PM_TOOL_PARAMETERS_SCHEMA_MAJOR, PM_TOOL_PARAMETERS_SCHEMA_VERSION, PM_OUTPUT_BUDGET_CLASSES, PM_OUTPUT_DEGRADATION_STEPS, PROFILE_FLAG_CONTRACTS, REINDEX_FLAG_CONTRACTS, RELEASE_FLAG_CONTRACTS, REMIND_FLAG_CONTRACTS, RESTORE_FLAG_CONTRACTS, SCHEMA_FLAG_CONTRACTS, SEARCH_COMMANDER_STRING_OPTION_CONTRACTS, SEARCH_FLAG_CONTRACTS, START_TASK_FLAG_CONTRACTS, STATS_FLAG_CONTRACTS, DUPLICATES_FLAG_CONTRACTS, SUBCOMMAND_GLOBAL_FLAG_CONTRACTS, TELEMETRY_FLAG_CONTRACTS, TEST_ALL_FLAG_CONTRACTS, TEST_FLAG_CONTRACTS, TEST_RUNS_FLAG_CONTRACTS, TOOL_ACTIVITY_OPTION_CONTRACTS, TOOL_AGGREGATE_OPTION_CONTRACTS, TOOL_BULK_MUTATION_FILTER_OPTION_CONTRACT_SOURCE, TOOL_CALENDAR_OPTION_CONTRACTS, TOOL_CLOSE_MANY_FILTER_OPTION_CONTRACTS, TOOL_CONTEXT_OPTION_CONTRACTS, TOOL_CREATE_OPTION_CONTRACTS, TOOL_CREATE_OPTION_CONTRACT_SOURCE, TOOL_DEPS_OPTION_CONTRACTS, TOOL_GRAPH_OPTION_CONTRACTS, TOOL_LIST_FILTER_OPTION_CONTRACTS, TOOL_SEARCH_FILTER_OPTION_CONTRACTS, TOOL_SHARED_CREATE_UPDATE_OPTION_CONTRACTS, TOOL_SHARED_CREATE_UPDATE_OPTION_CONTRACT_SOURCE, TOOL_UPDATE_MANY_FILTER_OPTION_CONTRACTS, TOOL_UPDATE_OPTION_CONTRACTS, TOOL_UPDATE_OPTION_CONTRACT_SOURCE, verifyToolOptionCliParity, UPDATE_COMMANDER_OPTION_REGISTRATION_CONTRACTS, UPDATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS, UPDATE_COMMANDER_STRING_OPTION_CONTRACTS, UPDATE_FLAG_CONTRACTS, UPDATE_MANY_FLAG_CONTRACTS, UPGRADE_FLAG_CONTRACTS, VALIDATE_FLAG_CONTRACTS, WORKSPACE_FLAG_CONTRACTS, buildPmActionToolInputSchema, PM_TOOL_RESERVED_CUSTOM_FIELD_PROPERTIES, compactFlagAliasContracts, createPmCommandOutputBudget, definePmCommandOutputBudget, estimatePmOutputTokens, inferPmOutputBudgetClass, analyzeSdkCliParameterCompleteness, isPmExtensionCapabilityContract, isPmExtensionPolicyModeContract, isPmExtensionPolicySurfaceContract, isPmExtensionServiceNameContract, isPmToolAction, hasSubcommandFlagContractsForCommand, readFirstStringFromCommanderOptions, readFirstValueFromCommanderOptions, readStringArrayFromCommanderOptions, resolvePmPositionalActionFlagContracts, resolveSubcommandFlagContractsForCommand, resolvePmCommandOutputBudget, resolvePmToolCustomFieldCollision, toCompletionFlagString, withFlagAliasMetadata, } from "./cli-contracts.js";
57
57
  export * from "./compose.js";
58
58
  export * from "./governance/assurance.js";
59
59
  export * from "./governance/assurance-action.js";
@@ -82,6 +82,7 @@ export * from "./context-packing.js";
82
82
  export * from "./context-usage.js";
83
83
  export * from "./dependency-provenance.js";
84
84
  export * from "./duplicates.js";
85
+ export * from "./lifecycle/reopen.js";
85
86
  export * from "./history-compact.js";
86
87
  export * from "./history-read.js";
87
88
  export * from "./history-provenance.js";
@@ -118,6 +119,7 @@ export * from "./error-code-catalog.js";
118
119
  export * from "./generated-error-code-catalog.js";
119
120
  export * from "./agent/refusal-reachability.js";
120
121
  export * from "./agent/refusal-closure.js";
122
+ export * from "./agent/closed-domain-contracts.js";
121
123
  export * from "./agent/subcommand-recovery.js";
122
124
  export * from "./flag-invocation-contracts.js";
123
125
  export * from "./cli-contracts/flag-lexicon-contracts.js";
@@ -135,7 +137,7 @@ export { runLearnings } from "./learnings.js";
135
137
  export { runUpgrade } from "./governance/upgrade.js";
136
138
  export { PLAN_SHOW_DEPTH_VALUES, PLAN_SUBCOMMANDS, PLAN_TEMPLATE_NAMES, } from "./lifecycle/plan.js";
137
139
  export * from "./define.js";
138
- export { BASELINE_ITEM_FORMAT_VERSION, BUILTIN_ITEM_TYPE_VALUES, CONFIDENCE_TEXT_VALUES, CURRENT_ITEM_FORMAT_VERSION, DEPENDENCY_KIND_VALUES, EXIT_CODE, ISSUE_SEVERITY_VALUES, ITEM_TYPE_VALUES, PM_CLI_EXPECTED_ERROR_NAME, PmCliError, PmClient, RISK_VALUES, STATUS_VALUES, acquireLock, appendHistoryEntry, canonicalDocument, classifyItemFormatVersion, clearWorkspaceContractsCache, commitImportedItem, createHistoryEntry, createPmCliExpectedError, effectiveItemFormatVersion, emptyImportedDocument, ensureTrackerInitialized, generateItemId, getActiveExtensionRegistrations, getContracts, getHistoryPath, getItemPath, getSettingsPath, getWorkspaceContracts, isPmCliExpectedError, isTimestampLiteral, listAllItemMetadata, loadCreateTemplateOptions, locateItem, normalizeItemMetadata, normalizeItemFormatVersion, normalizeItemId, normalizeRawItemId, normalizeStatusInput, nowIso, parseTags, pathExists, readBooleanOption, readCsvListOption, readFileIfExists, readLocatedItem, readRequiredString, readSettings, readStringOption, removeFileIfExists, renderCalendarMarkdown, renderCalendarToon, renderGuideMarkdown, resolveCalendarOutputFormat, resolveGuideOutputFormat, resolveItemTypeRegistry, resolveImplicitPmRoot, resolvePmRoot, resolveRuntimeFieldRegistry, resolveRuntimeStatusRegistry, runAction, runActiveOnReadHooks, runActiveOnWriteHooks, runCalendar, runCompletion, runGuide, runList, runReindex, runSearch, runTemplatesList, runTemplatesSave, runTemplatesShow, runTestRunsList, runTestRunsLogs, runTestRunsResume, runTestRunsStatus, runTestRunsStop, scanItemFormatVersions, selectImportAuthor, serializeItemDocument, splitFrontMatter, toEstimatedMinutesValue, toImportBoolean, toImportConfidence, toImportInteger, toImportLinkedDocs, toImportLinkedFiles, toImportLinkedTests, toImportLogEntries, toImportNormalizedEnum, toImportNumberMap, toImportPriority, toImportStatus, toImportStringList, toImportStringMap, toImportTags, toNonEmptyImportString, writeFileAtomic, aggregate, append, claim, claimNext, close, closeTask, comments, config, context, copy, create, deleteItem, deps, docs, duplicates, extension, extensionActivate, extensionDeactivate, extensionList, files, filesDiscover, filesLookup, focus, gc, get, graph, health, historyCompact, historyCompactBulk, historyRedact, historyRepair, historyRepairAll, init, learnings, list, listAllComplete, next, notes, packageActivate, packageCatalog, packageDeactivate, packageDescribe, packageDoctor, packageInstall, packageLifecycle, packageList, packageManage, packageReload, packageUninstall, pauseTask, profile, profileApply, profileLint, profileList, profileShow, release, restore, schema, schemaAddField, schemaAddStatus, schemaAddType, schemaApplyPreset, schemaInferTypes, schemaList, schemaListFields, schemaRemapStatus, schemaRemoveField, schemaRemoveStatus, schemaRemoveType, schemaShow, schemaShowField, schemaShowStatus, schemaRenameField, schemaRenameType, search, startTask, stats, update, upgrade, validate, } from "./runtime.js";
140
+ export { BASELINE_ITEM_FORMAT_VERSION, BUILTIN_ITEM_TYPE_VALUES, CONFIDENCE_TEXT_VALUES, CURRENT_ITEM_FORMAT_VERSION, DEPENDENCY_KIND_VALUES, EXIT_CODE, ISSUE_SEVERITY_VALUES, ITEM_TYPE_VALUES, PM_CLI_EXPECTED_ERROR_NAME, PmCliError, PmClient, RISK_VALUES, STATUS_VALUES, acquireLock, appendHistoryEntry, canonicalDocument, classifyItemFormatVersion, clearWorkspaceContractsCache, commitImportedItem, createHistoryEntry, createPmCliExpectedError, effectiveItemFormatVersion, emptyImportedDocument, ensureTrackerInitialized, generateItemId, getActiveExtensionRegistrations, getContracts, getHistoryPath, getItemPath, getSettingsPath, getWorkspaceContracts, isPmCliExpectedError, isTimestampLiteral, listAllItemMetadata, loadCreateTemplateOptions, locateItem, normalizeItemMetadata, normalizeItemFormatVersion, normalizeItemId, normalizeRawItemId, normalizeStatusInput, nowIso, parseTags, pathExists, readBooleanOption, readCsvListOption, readFileIfExists, readLocatedItem, readRequiredString, readSettings, readStringOption, removeFileIfExists, renderCalendarMarkdown, renderCalendarToon, renderGuideMarkdown, resolveCalendarOutputFormat, resolveGuideOutputFormat, resolveItemTypeRegistry, resolveImplicitPmRoot, resolvePmRoot, resolveRuntimeFieldRegistry, resolveRuntimeStatusRegistry, runAction, runActiveOnReadHooks, runActiveOnWriteHooks, runCalendar, runCompletion, runGuide, runList, runReindex, runSearch, runTemplatesList, runTemplatesSave, runTemplatesShow, runTestRunsList, runTestRunsLogs, runTestRunsResume, runTestRunsStatus, runTestRunsStop, scanItemFormatVersions, selectImportAuthor, serializeItemDocument, splitFrontMatter, toEstimatedMinutesValue, toImportBoolean, toImportConfidence, toImportInteger, toImportLinkedDocs, toImportLinkedFiles, toImportLinkedTests, toImportLogEntries, toImportNormalizedEnum, toImportNumberMap, toImportPriority, toImportStatus, toImportStringList, toImportStringMap, toImportTags, toNonEmptyImportString, writeFileAtomic, aggregate, append, claim, claimNext, close, reopen, closeTask, comments, config, context, copy, create, deleteItem, deps, docs, duplicates, extension, extensionActivate, extensionDeactivate, extensionList, files, filesDiscover, filesLookup, focus, gc, get, graph, health, historyCompact, historyCompactBulk, historyRedact, historyRepair, historyRepairAll, init, learnings, list, listAllComplete, next, notes, packageActivate, packageCatalog, packageDeactivate, packageDescribe, packageDoctor, packageInstall, packageLifecycle, packageList, packageManage, packageReload, packageUninstall, pauseTask, profile, profileApply, profileLint, profileList, profileShow, release, restore, schema, schemaAddField, schemaAddStatus, schemaAddType, schemaApplyPreset, schemaInferTypes, schemaList, schemaListFields, schemaRemapStatus, schemaRemoveField, schemaRemoveStatus, schemaRemoveType, schemaShow, schemaShowField, schemaShowStatus, schemaRenameField, schemaRenameType, search, startTask, stats, update, upgrade, validate, } from "./runtime.js";
139
141
  export { extensionMigrate, packageMigrate } from "./package-migrations.js";
140
142
  export { CONTEXT_OUTPUT_VALUES, NEXT_OUTPUT_VALUES, PM_GITIGNORE_END, PM_GITIGNORE_START, analyzeSdkActionCoverage, ensurePmGitignore, getPmGitignoreBlock, closeItem, runAggregate, runClose, runCopy, runContext, runDelete, runFocus, runGet, runNext, runRestore, runUpdate, } from "./runtime.js";
141
143
  export { runStats } from "./stats.js";
@@ -157,4 +159,4 @@ export * from "./governance.js";
157
159
  export * from "./query.js";
158
160
  export * from "./testing.js";
159
161
  //# sourceMappingURL=index.js.map
160
- //# debugId=3236ba3b-d3ac-5760-90a4-022ff103b952
162
+ //# debugId=69a0f0d4-50f9-5063-9cc6-64de2abac82e
@@ -89,11 +89,13 @@ declare function toPortableRelativePath(projectRoot: string, targetPath: string)
89
89
  declare function ensureTrailingNewline(value: string): string;
90
90
  declare function detectLineEnding(value: string): "\n" | "\r\n";
91
91
  declare function findGuidanceBlockRange(content: string): AgentGuidanceBlockRange | null;
92
- declare function buildAgentGuidanceBlock(lineEnding: "\n" | "\r\n"): string;
93
- declare function upsertAgentGuidanceBlock(existingContent: string): {
92
+ declare function buildAgentGuidanceBlock(lineEnding: "\n" | "\r\n", projectTestCommand?: string): string;
93
+ declare function upsertAgentGuidanceBlock(existingContent: string, projectTestCommand?: string): {
94
94
  next_content: string;
95
95
  changed: boolean;
96
96
  };
97
+ /** Resolve an executable linked-test command from a target repository's own files. */
98
+ export declare function resolveProjectTestCommand(projectRoot: string): Promise<string>;
97
99
  declare function resolveProjectRoot(pmRoot: string, cwd: string): string;
98
100
  declare function resolveTargetGuidancePath(scans: AgentGuidanceFileScan[], projectRoot: string): string;
99
101
  declare function parsePromptChoice(answer: string, currentDefault: boolean): boolean;
@@ -104,7 +106,7 @@ declare function applyAgentGuidanceState(settings: PmSettings, currentState: PmS
104
106
  changed: boolean;
105
107
  state: PmSettings["agent_guidance"];
106
108
  };
107
- declare function writeGuidanceFile(filePath: string): Promise<{
109
+ declare function writeGuidanceFile(filePath: string, projectRoot?: string): Promise<{
108
110
  changed: boolean;
109
111
  warnings: string[];
110
112
  }>;
@@ -4,7 +4,7 @@
4
4
  * Implements the pm init agent guidance command surface and its agent-facing runtime behavior.
5
5
  */
6
6
 
7
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="b7c97e30-02c8-547c-b3db-c6c59e662b54")}catch(e){}}();
7
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="e404796d-439b-5f4c-9330-5b12ff41d7b2")}catch(e){}}();
8
8
  import fs from "node:fs/promises";
9
9
  import path from "node:path";
10
10
  import readline from "node:readline/promises";
@@ -91,14 +91,14 @@ function findGuidanceBlockRange(content) {
91
91
  function hasGuidanceMarker(content) {
92
92
  return findGuidanceBlockRange(content) !== null;
93
93
  }
94
- function buildAgentGuidanceBlock(lineEnding) {
94
+ function buildAgentGuidanceBlock(lineEnding, projectTestCommand = "<your project test command>") {
95
95
  const lines = [
96
96
  AGENT_GUIDANCE_START_MARKER,
97
97
  "## pm Workflow (Agent Quickstart)",
98
98
  "",
99
99
  '- Orient before mutate: `pm context --limit 10`, `pm search "<keywords>" --limit 10`, `pm list --status open --limit 20`.',
100
100
  "- Claim and execute: `pm claim <id>` then `pm update <id> --status in_progress`.",
101
- '- Link evidence while coding: `pm files <id> --add ...`, `pm docs <id> --add ...`, `pm test <id> --add command="node scripts/run-tests.mjs test -- ..."`.',
101
+ `- Link evidence while coding: \`pm files <id> --add ...\`, \`pm docs <id> --add ...\`, \`pm test <id> --add command="${projectTestCommand}"\`.`,
102
102
  '- Verify and close: `pm test <id> --run --progress`, `pm close <id> "<evidence>" --validate-close warn`, `pm release <id>`.',
103
103
  "- Author identity is automatic for supported agent harnesses; use `--author` only for an explicit override.",
104
104
  "",
@@ -107,9 +107,9 @@ function buildAgentGuidanceBlock(lineEnding) {
107
107
  ];
108
108
  return lines.join(lineEnding);
109
109
  }
110
- function upsertAgentGuidanceBlock(existingContent) {
110
+ function upsertAgentGuidanceBlock(existingContent, projectTestCommand = "<your project test command>") {
111
111
  const lineEnding = detectLineEnding(existingContent);
112
- const nextBlock = buildAgentGuidanceBlock(lineEnding);
112
+ const nextBlock = buildAgentGuidanceBlock(lineEnding, projectTestCommand);
113
113
  const existingRange = findGuidanceBlockRange(existingContent);
114
114
  if (existingRange) {
115
115
  const trailingContent = existingContent.slice(existingRange.end_index);
@@ -135,6 +135,65 @@ function upsertAgentGuidanceBlock(existingContent) {
135
135
  changed: nextContent !== existingContent,
136
136
  };
137
137
  }
138
+ /** Resolve an executable linked-test command from a target repository's own files. */
139
+ export async function resolveProjectTestCommand(projectRoot) {
140
+ if (await pathExists(path.join(projectRoot, "scripts", "run-tests.mjs"))) {
141
+ return "node scripts/run-tests.mjs test";
142
+ }
143
+ let packageDocument;
144
+ try {
145
+ packageDocument = JSON.parse(await fs.readFile(path.join(projectRoot, "package.json"), "utf8"));
146
+ }
147
+ catch {
148
+ return "<your project test command>";
149
+ }
150
+ const manifest = normalizeProjectPackageManifest(packageDocument);
151
+ if (manifest === undefined) {
152
+ return "<your project test command>";
153
+ }
154
+ const packageManager = manifest.packageManager?.split("@")[0];
155
+ if (packageManager === "pnpm") {
156
+ return "pnpm test";
157
+ }
158
+ if (packageManager === "bun") {
159
+ return "bun run test";
160
+ }
161
+ if (packageManager === "yarn") {
162
+ return "yarn test";
163
+ }
164
+ if (packageManager === "npm")
165
+ return "npm test";
166
+ if (await pathExists(path.join(projectRoot, "pnpm-lock.yaml"))) {
167
+ return "pnpm test";
168
+ }
169
+ if ((await pathExists(path.join(projectRoot, "bun.lock"))) ||
170
+ (await pathExists(path.join(projectRoot, "bun.lockb")))) {
171
+ return "bun run test";
172
+ }
173
+ if (await pathExists(path.join(projectRoot, "yarn.lock")))
174
+ return "yarn test";
175
+ return "npm test";
176
+ }
177
+ /** Validate the minimal package manifest shape needed for executable test guidance. */
178
+ function normalizeProjectPackageManifest(value) {
179
+ if (typeof value !== "object" || value === null || !("scripts" in value)) {
180
+ return undefined;
181
+ }
182
+ const scripts = value.scripts;
183
+ if (typeof scripts !== "object" ||
184
+ scripts === null ||
185
+ !("test" in scripts) ||
186
+ typeof scripts.test !== "string" ||
187
+ scripts.test.trim().length === 0) {
188
+ return undefined;
189
+ }
190
+ return {
191
+ scripts: { test: scripts.test },
192
+ ...("packageManager" in value && typeof value.packageManager === "string"
193
+ ? { packageManager: value.packageManager }
194
+ : {}),
195
+ };
196
+ }
138
197
  function resolveProjectRoot(pmRoot, cwd) {
139
198
  const parent = path.dirname(pmRoot);
140
199
  if (path.basename(pmRoot) === "pm" && path.basename(parent) === ".agents") {
@@ -240,10 +299,10 @@ function applyAgentGuidanceState(settings, currentState) {
240
299
  }
241
300
  return { changed, state: currentState };
242
301
  }
243
- async function writeGuidanceFile(filePath) {
302
+ async function writeGuidanceFile(filePath, projectRoot = path.dirname(filePath)) {
244
303
  const exists = await pathExists(filePath);
245
304
  const currentContent = exists ? await fs.readFile(filePath, "utf8") : "";
246
- const nextContent = upsertAgentGuidanceBlock(currentContent);
305
+ const nextContent = upsertAgentGuidanceBlock(currentContent, await resolveProjectTestCommand(projectRoot));
247
306
  if (!nextContent.changed) {
248
307
  return { changed: false, warnings: [] };
249
308
  }
@@ -292,7 +351,7 @@ async function addAgentGuidanceBlockIfMissing(flow, context) {
292
351
  if (context.presentBefore) {
293
352
  return;
294
353
  }
295
- const writeResult = await writeGuidanceFile(context.targetPath);
354
+ const writeResult = await writeGuidanceFile(context.targetPath, context.projectRoot);
296
355
  flow.warnings.push(...writeResult.warnings);
297
356
  if (writeResult.changed) {
298
357
  flow.applied = true;
@@ -413,6 +472,7 @@ export async function runInitAgentGuidance(options) {
413
472
  targetRelativePath,
414
473
  checkedFiles,
415
474
  presentBefore,
475
+ projectRoot,
416
476
  });
417
477
  const stateUpdate = applyAgentGuidanceState(options.settings, flow.state);
418
478
  scans = await refreshGuidanceScansAfterApply(flow.applied, scans, projectRoot);
@@ -434,4 +494,4 @@ export async function runInitAgentGuidance(options) {
434
494
  };
435
495
  }
436
496
  //# sourceMappingURL=init-agent-guidance.js.map
437
- //# debugId=b7c97e30-02c8-547c-b3db-c6c59e662b54
497
+ //# debugId=e404796d-439b-5f4c-9330-5b12ff41d7b2
@@ -0,0 +1,18 @@
1
+ import type { GlobalOptions } from "../../core/shared/command-types.js";
2
+ /** Minimal generic dispatch context consumed by lifecycle mutation adapters. */
3
+ export interface LifecycleMutationActionContext {
4
+ /** Flat MCP/action arguments. */
5
+ args: Record<string, unknown>;
6
+ /** Normalized command option bag. */
7
+ options: Record<string, unknown>;
8
+ /** Item id resolved from flat arguments, when present. */
9
+ id: string | undefined;
10
+ /** Normalized transport-level force override. */
11
+ force?: boolean;
12
+ /** Presentation-neutral global command options. */
13
+ global: GlobalOptions;
14
+ }
15
+ /** Dispatch close through the shared MCP mutation compaction contract. */
16
+ export declare function runMcpCloseAction(context: LifecycleMutationActionContext): Promise<unknown>;
17
+ /** Dispatch recurrence through the shared MCP mutation compaction contract. */
18
+ export declare function runMcpReopenAction(context: LifecycleMutationActionContext): Promise<unknown>;
@@ -0,0 +1,52 @@
1
+ /**
2
+ * @module sdk/runtime-mutation-actions
3
+ *
4
+ * Keeps lifecycle-specific MCP mutation adapters outside the generic runtime
5
+ * dispatcher while preserving the shared token-efficient result projection.
6
+ */
7
+
8
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="55869854-565d-52d2-8dca-b66aade074bb")}catch(e){}}();
9
+ import { projectMutationResult } from "../../core/output/mutation-projection.js";
10
+ import { PmCliError } from "../../core/shared/errors.js";
11
+ import { runClose } from "./close.js";
12
+ import { runReopen } from "./reopen.js";
13
+ import { readRuntimeString, withMutationCompaction } from "../runtime-input.js";
14
+ function requireLifecycleItemId(context, options) {
15
+ const id = context.id ?? readRuntimeString(options, "id");
16
+ if (!id) {
17
+ throw new PmCliError("Missing required argument: id", 64);
18
+ }
19
+ return id;
20
+ }
21
+ function readLifecycleReason(context, options) {
22
+ return (readRuntimeString(context.args, "reason") ??
23
+ readRuntimeString(context.args, "text") ??
24
+ readRuntimeString(options, "reason") ??
25
+ readRuntimeString(options, "text"));
26
+ }
27
+ /** Dispatch close through the shared MCP mutation compaction contract. */
28
+ export async function runMcpCloseAction(context) {
29
+ const { changedFields, idOnly, runnerOptions } = withMutationCompaction(context.args, context.options);
30
+ return projectMutationResult(await runClose(requireLifecycleItemId(context, runnerOptions), readLifecycleReason(context, runnerOptions), {
31
+ ...runnerOptions,
32
+ force: context.force === true || runnerOptions.force === true,
33
+ }, context.global), {
34
+ changedFields,
35
+ compactEnvelope: changedFields === "compact" && !idOnly,
36
+ idOnly,
37
+ });
38
+ }
39
+ /** Dispatch recurrence through the shared MCP mutation compaction contract. */
40
+ export async function runMcpReopenAction(context) {
41
+ const { changedFields, idOnly, runnerOptions } = withMutationCompaction(context.args, context.options);
42
+ return projectMutationResult(await runReopen(requireLifecycleItemId(context, runnerOptions), readLifecycleReason(context, runnerOptions) ?? "", {
43
+ ...runnerOptions,
44
+ force: context.force === true || runnerOptions.force === true,
45
+ }, context.global), {
46
+ changedFields,
47
+ compactEnvelope: changedFields === "compact" && !idOnly,
48
+ idOnly,
49
+ });
50
+ }
51
+ //# sourceMappingURL=mcp-actions.js.map
52
+ //# debugId=55869854-565d-52d2-8dca-b66aade074bb
@@ -0,0 +1,44 @@
1
+ /**
2
+ * @module sdk/lifecycle/reopen
3
+ *
4
+ * Reopens terminal work as a recurrence while preserving immutable closure
5
+ * evidence and delegating every state change to the canonical update pipeline.
6
+ */
7
+ import type { GlobalOptions } from "../../core/shared/command-types.js";
8
+ import { type PreviousTerminalEvidence } from "./update.js";
9
+ export type { PreviousTerminalEvidence } from "./update.js";
10
+ /** Options accepted by the SDK and `pm item reopen` recurrence primitive. */
11
+ export interface ReopenCommandOptions {
12
+ /** Active target status; only the workspace open or in-progress status is allowed. */
13
+ status?: string;
14
+ /** Explicit mutation author override. */
15
+ author?: string;
16
+ /** Optional human-readable history message in addition to structured recurrence context. */
17
+ message?: string;
18
+ /** Override an ownership or stale-lock conflict. */
19
+ force?: boolean;
20
+ }
21
+ /** Structured recurrence receipt returned by every presentation surface. */
22
+ export interface RecurrenceReceipt {
23
+ /** Required reason that the terminal work became active again. */
24
+ reason: string;
25
+ /** Terminal status observed while holding the item lock. */
26
+ from_status: string;
27
+ /** Active status written through the update pipeline. */
28
+ to_status: string;
29
+ /** Prior terminal evidence retained in immutable history. */
30
+ previous_terminal: PreviousTerminalEvidence;
31
+ }
32
+ /** Result returned after a terminal item is reopened. */
33
+ export interface ReopenResult {
34
+ /** Reopened item metadata. */
35
+ item: Record<string, unknown>;
36
+ /** Fields changed by the canonical update pipeline. */
37
+ changed_fields: string[];
38
+ /** Non-fatal mutation and extension warnings. */
39
+ warnings: string[];
40
+ /** Immutable recurrence transition receipt. */
41
+ recurrence: RecurrenceReceipt;
42
+ }
43
+ /** Reopen terminal work through the canonical update mutation and history path. */
44
+ export declare function runReopen(id: string, reason: string, options: ReopenCommandOptions, global: GlobalOptions): Promise<ReopenResult>;
@@ -0,0 +1,69 @@
1
+
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="08dcee99-5572-5133-b76a-6a50e4e292e7")}catch(e){}}();
3
+ import { EXIT_CODE } from "../../core/shared/constants.js";
4
+ import { PmCliError } from "../../core/shared/errors.js";
5
+ import { normalizeStatusInput } from "../../core/item/status.js";
6
+ import { resolveRuntimeStatusRegistry } from "../../core/schema/runtime-schema.js";
7
+ import { resolvePmRoot } from "../../core/store/paths.js";
8
+ import { readSettings } from "../../core/store/settings.js";
9
+ import { resolveStartTaskInProgressStatus } from "../start-task-status.js";
10
+ import { runReopenUpdate, } from "./update.js";
11
+ /** Reopen terminal work through the canonical update mutation and history path. */
12
+ export async function runReopen(id, reason, options, global) {
13
+ const normalizedReason = reason.trim();
14
+ if (normalizedReason.length === 0) {
15
+ throw new PmCliError("pm item reopen requires a non-empty recurrence reason.", EXIT_CODE.USAGE, {
16
+ code: "reopen_reason_required",
17
+ required: "Describe why the terminal work became active again.",
18
+ recovery: {
19
+ suggested_retry: `pm item reopen ${id} "<recurrence reason>"`,
20
+ suggested_retry_args: ["item", "reopen", id, "<recurrence reason>"],
21
+ },
22
+ });
23
+ }
24
+ const pmRoot = resolvePmRoot(process.cwd(), global.path);
25
+ const statusRegistry = resolveRuntimeStatusRegistry((await readSettings(pmRoot)).schema);
26
+ const openStatus = statusRegistry.open_status;
27
+ const inProgressStatus = resolveStartTaskInProgressStatus(statusRegistry);
28
+ const requestedStatus = options.status ?? openStatus;
29
+ const targetStatus = normalizeStatusInput(requestedStatus, statusRegistry) ?? requestedStatus;
30
+ if (targetStatus !== openStatus && targetStatus !== inProgressStatus) {
31
+ throw new PmCliError(`Reopen target status must be ${openStatus} or ${inProgressStatus}; received ${requestedStatus}.`, EXIT_CODE.USAGE, {
32
+ code: "reopen_target_status_invalid",
33
+ required: "Choose the workspace open or in-progress lifecycle status.",
34
+ recovery: {
35
+ allowed_values: [...new Set([openStatus, inProgressStatus])],
36
+ suggested_retry: `pm item reopen ${id} "${normalizedReason}" --status ${openStatus}`,
37
+ suggested_retry_args: [
38
+ "item",
39
+ "reopen",
40
+ id,
41
+ normalizedReason,
42
+ "--status",
43
+ openStatus,
44
+ ],
45
+ },
46
+ });
47
+ }
48
+ const update = await runReopenUpdate(id, {
49
+ status: targetStatus,
50
+ unset: [
51
+ "close-reason",
52
+ "resolution",
53
+ "expected-result",
54
+ "actual-result",
55
+ "fixed-version",
56
+ ],
57
+ author: options.author,
58
+ message: options.message,
59
+ force: options.force,
60
+ }, global, normalizedReason);
61
+ return {
62
+ item: update.item,
63
+ changed_fields: update.changed_fields,
64
+ warnings: update.warnings,
65
+ recurrence: update.lifecycle_transition,
66
+ };
67
+ }
68
+ //# sourceMappingURL=reopen.js.map
69
+ //# debugId=08dcee99-5572-5133-b76a-6a50e4e292e7
@@ -67,6 +67,35 @@ export interface UpdateResult {
67
67
  /** Value that configures or reports warnings for this contract. */
68
68
  warnings: string[];
69
69
  }
70
+ /** Terminal evidence captured atomically before a recurrence transition. */
71
+ export interface PreviousTerminalEvidence {
72
+ /** Prior close reason, when recorded. */
73
+ close_reason?: string;
74
+ /** Prior structured resolution, when recorded. */
75
+ resolution?: string;
76
+ /** Prior expected result, when recorded. */
77
+ expected_result?: string;
78
+ /** Prior actual result, when recorded. */
79
+ actual_result?: string;
80
+ /** Prior fixed version, when recorded. */
81
+ fixed_version?: string;
82
+ }
83
+ /** Internal update-path receipt consumed by the public recurrence primitive. */
84
+ export interface ReopenUpdateReceipt {
85
+ /** Recurrence reason stored in immutable history context. */
86
+ reason: string;
87
+ /** Terminal status observed while holding the item lock. */
88
+ from_status: string;
89
+ /** Active status written by the update path. */
90
+ to_status: string;
91
+ /** Terminal evidence removed from active metadata but retained in history. */
92
+ previous_terminal: PreviousTerminalEvidence;
93
+ }
94
+ /** Update result carrying the recurrence receipt produced by the locked transition. */
95
+ export interface ReopenUpdateResult extends UpdateResult {
96
+ /** Lifecycle-specific receipt populated by the recurrence primitive. */
97
+ lifecycle_transition: ReopenUpdateReceipt;
98
+ }
70
99
  declare function normalizeLegacyNoneUpdateOptions(options: UpdateCommandOptions): UpdateCommandOptions;
71
100
  declare function parseUpdateUnsetTargets(raw: string[] | undefined, runtimeFieldRegistry?: RuntimeFieldRegistry, extensionFieldNames?: readonly string[]): {
72
101
  metadataKeys: Set<string>;
@@ -139,6 +168,8 @@ type UpdateStatusMutationContext = Pick<UpdateMutationContext, "options" | "stat
139
168
  declare function applyStatusAndCloseReasonMutations(document: ItemDocument, context: UpdateStatusMutationContext, previousStatusNormalized: string, changedFields: string[]): void;
140
169
  /** Implements run update for the public runtime surface of this module. */
141
170
  export declare function runUpdate(id: string, options: UpdateCommandOptions, global: GlobalOptions): Promise<UpdateResult>;
171
+ /** Execute a recurrence transition through the exact atomic update pipeline. */
172
+ export declare function runReopenUpdate(id: string, options: UpdateCommandOptions, global: GlobalOptions, recurrenceReason: string): Promise<ReopenUpdateResult>;
142
173
  /** Public contract for test only update command, shared by SDK and presentation-layer consumers. */
143
174
  export declare const _testOnlyUpdateCommand: {
144
175
  applyStatusAndCloseReasonMutations: typeof applyStatusAndCloseReasonMutations;